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
f68e64c6
Commit
f68e64c6
authored
Jul 25, 2016
by
Vadym
Committed by
Dominic Hamon
Jul 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for step in DenseRange() (#260)
parent
a2ca94dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
benchmark_api.h
include/benchmark/benchmark_api.h
+2
-2
benchmark.cc
src/benchmark.cc
+5
-5
No files found.
include/benchmark/benchmark_api.h
View file @
f68e64c6
...
...
@@ -489,9 +489,9 @@ public:
// REQUIRES: The function passed to the constructor must accept an arg1.
Benchmark
*
Range
(
int
start
,
int
limit
);
// Run this benchmark once for
every value in the range [start..limit]
// Run this benchmark once for
all values in the range [start..limit] with specific step
// REQUIRES: The function passed to the constructor must accept an arg1.
Benchmark
*
DenseRange
(
int
start
,
int
limit
);
Benchmark
*
DenseRange
(
int
start
,
int
limit
,
int
step
=
1
);
// Run this benchmark once with "x,y" as the extra arguments passed
// to the function.
...
...
src/benchmark.cc
View file @
f68e64c6
...
...
@@ -354,7 +354,7 @@ public:
void
Arg
(
int
x
);
void
Unit
(
TimeUnit
unit
);
void
Range
(
int
start
,
int
limit
);
void
DenseRange
(
int
start
,
int
limit
);
void
DenseRange
(
int
start
,
int
limit
,
int
step
=
1
);
void
ArgPair
(
int
start
,
int
limit
);
void
RangePair
(
int
lo1
,
int
hi1
,
int
lo2
,
int
hi2
);
void
RangeMultiplier
(
int
multiplier
);
...
...
@@ -518,12 +518,12 @@ void BenchmarkImp::Range(int start, int limit) {
}
}
void
BenchmarkImp
::
DenseRange
(
int
start
,
int
limit
)
{
void
BenchmarkImp
::
DenseRange
(
int
start
,
int
limit
,
int
step
)
{
CHECK
(
arg_count_
==
-
1
||
arg_count_
==
1
);
arg_count_
=
1
;
CHECK_GE
(
start
,
0
);
CHECK_LE
(
start
,
limit
);
for
(
int
arg
=
start
;
arg
<=
limit
;
arg
++
)
{
for
(
int
arg
=
start
;
arg
<=
limit
;
arg
+=
step
)
{
args_
.
emplace_back
(
arg
,
-
1
);
}
}
...
...
@@ -655,8 +655,8 @@ Benchmark* Benchmark::Range(int start, int limit) {
return
this
;
}
Benchmark
*
Benchmark
::
DenseRange
(
int
start
,
int
limit
)
{
imp_
->
DenseRange
(
start
,
limit
);
Benchmark
*
Benchmark
::
DenseRange
(
int
start
,
int
limit
,
int
step
)
{
imp_
->
DenseRange
(
start
,
limit
,
step
);
return
this
;
}
...
...
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