Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
llvm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
llvm-watermarker
Commits
9eb92979
Commit
9eb92979
authored
Jan 10, 2019
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
プロセス時間計測に`chrono`ではなく`std::clock()`を使用するように変更
parent
b40c6c4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
.gitignore
.gitignore
+2
-0
benchmark.cpp
example/zlib/benchmark.cpp
+13
-10
No files found.
.gitignore
View file @
9eb92979
bin/
bin/
obj/
obj/
.vscode/
example/zlib/benchmark.cpp
View file @
9eb92979
#include <array>
#include <ctime>
#include <chrono>
#include <cstddef>
#include <cstddef>
#include <iostream>
#include <cstdio>
#include <array>
#include <random>
#include <random>
#include <vector>
#include <vector>
...
@@ -36,11 +36,11 @@ namespace
...
@@ -36,11 +36,11 @@ namespace
}
}
template
<
typename
F
>
template
<
typename
F
>
std
::
c
hrono
::
high_resolution_clock
::
duration
measure
(
F
&&
f
)
std
::
c
lock_t
measure
(
F
&&
f
)
{
{
const
auto
start
=
std
::
c
hrono
::
high_resolution_clock
::
now
();
const
auto
start
=
std
::
c
lock
();
f
();
f
();
const
auto
end
=
std
::
c
hrono
::
high_resolution_clock
::
now
();
const
auto
end
=
std
::
c
lock
();
return
end
-
start
;
return
end
-
start
;
}
}
...
@@ -85,7 +85,7 @@ int main()
...
@@ -85,7 +85,7 @@ int main()
return
std
::
vector
<
std
::
byte
>
(
std
::
begin
(
data
),
std
::
end
(
data
));
return
std
::
vector
<
std
::
byte
>
(
std
::
begin
(
data
),
std
::
end
(
data
));
}();
}();
std
::
cout
<<
"compression[us],decompression[us]"
<<
std
::
endl
;
std
::
puts
(
"compression[us], decompression[us]"
)
;
constexpr
std
::
size_t
n
=
100
;
constexpr
std
::
size_t
n
=
100
;
...
@@ -101,8 +101,11 @@ int main()
...
@@ -101,8 +101,11 @@ int main()
decompression_test
(
compressed_test_data
,
output_buffer
);
decompression_test
(
compressed_test_data
,
output_buffer
);
});
});
std
::
cout
std
::
printf
(
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
compression_time
).
count
()
<<
","
"%f, %f
\n
"
,
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
decompression_time
).
count
()
<<
std
::
endl
;
1e6
*
compression_time
/
CLOCKS_PER_SEC
,
1e6
*
decompression_time
/
CLOCKS_PER_SEC
);
std
::
fflush
(
stdout
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment