Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
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
Chen Yisong
benchmark
Commits
f1e1ccaf
Commit
f1e1ccaf
authored
Jul 24, 2014
by
Dominic Hamon
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34 from predmond/master
fix examples to use SetBytesProcessed
parents
58e52ba3
0ce150e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
README.md
README.md
+2
-3
benchmark.h
include/benchmark/benchmark.h
+2
-2
No files found.
README.md
View file @
f1e1ccaf
...
...
@@ -49,10 +49,9 @@ of `memcpy()` calls of different lengths:
static
void
BM_memcpy
(
benchmark
::
State
&
state
)
{
char
*
src
=
new
char
[
state
.
range_x
()];
char
*
dst
=
new
char
[
state
.
range_x
()];
memset
(
src
,
'x'
,
state
.
range_x
());
while
(
state
.
KeepRunning
())
{
while
(
state
.
KeepRunning
())
memcpy
(
dst
,
src
,
state
.
range_x
());
benchmark
::
SetBenchmarkBytesProcessed
(
int64_t
(
state
.
iterations
)
*
int64_t
(
state
.
range_x
()));
state
.
SetBytesProcessed
(
int64_t
(
state
.
iterations
)
*
int64_t
(
state
.
range_x
()));
delete
[]
src
;
delete
[]
dst
;
}
...
...
include/benchmark/benchmark.h
View file @
f1e1ccaf
...
...
@@ -40,9 +40,9 @@ int main(int argc, char** argv) {
static void BM_memcpy(benchmark::State& state) {
char* src = new char[state.range_x()]; char* dst = new char[state.range_x()];
memset(src, 'x', state.range_x());
while (state.KeepRunning())
{
while (state.KeepRunning())
memcpy(dst, src, state.range_x());
SetBenchmark
BytesProcessed(int64_t_t(state.iterations) * int64(state.range_x()));
state.Set
BytesProcessed(int64_t_t(state.iterations) * int64(state.range_x()));
delete[] src; delete[] dst;
}
BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10);
...
...
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