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
57bf879d
Unverified
Commit
57bf879d
authored
Dec 14, 2018
by
Roman Lebedev
Committed by
GitHub
Dec 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
README.md: document State::{Pause,Resume}Timing()
As pointed out in IRC, these are not documented.
parent
0ed529a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
README.md
README.md
+20
-0
No files found.
README.md
View file @
57bf879d
...
@@ -428,6 +428,26 @@ BENCHMARK(BM_test)->Range(8, 8<<10)->UseRealTime();
...
@@ -428,6 +428,26 @@ BENCHMARK(BM_test)->Range(8, 8<<10)->UseRealTime();
Without
`UseRealTime`
, CPU time is used by default.
Without
`UseRealTime`
, CPU time is used by default.
## Controlling timers
Normally, the entire duration of the work loop (
`for (auto _ : state) {}`
)
is measured. But sometimes, it is nessesary to do some work inside of
that loop, every iteration, but without counting that time to the benchmark time.
That is possible, althought it is not recommended, since it has high overhead.
```
c++
static
void
BM_SetInsert_With_Timer_Control
(
benchmark
::
State
&
state
)
{
std
::
set
<
int
>
data
;
for
(
auto
_
:
state
)
{
state
.
PauseTiming
();
// Stop timers. They will not count until they are resumed.
data
=
ConstructRandomSet
(
state
.
range
(
0
));
// Do something that should not be measured
state
.
ResumeTiming
();
// And resume timers. They are now counting again.
// The rest will be measured.
for
(
int
j
=
0
;
j
<
state
.
range
(
1
);
++
j
)
data
.
insert
(
RandomNumber
());
}
}
BENCHMARK
(
BM_SetInsert_With_Timer_Control
)
->
Ranges
({{
1
<<
10
,
8
<<
10
},
{
128
,
512
}});
```
## Manual timing
## Manual timing
For benchmarking something for which neither CPU time nor real-time are
For benchmarking something for which neither CPU time nor real-time are
...
...
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