mirror of
https://github.com/google/benchmark.git
synced 2025-03-13 18:50:11 +08:00
parent
0d98dba29d
commit
31e7941796
@ -773,6 +773,16 @@ static void BM_MultiThreaded(benchmark::State& state) {
|
|||||||
BENCHMARK(BM_MultiThreaded)->Threads(2);
|
BENCHMARK(BM_MultiThreaded)->Threads(2);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To run the benchmark across a range of thread counts, instead of `Threads`, use
|
||||||
|
`ThreadRange`. This takes two parameters (`min_threads` and `max_threads`) and
|
||||||
|
runs the benchmark once for values in the inclusive range. For example:
|
||||||
|
|
||||||
|
```c++
|
||||||
|
BENCHMARK(BM_MultiThreaded)->ThreadRange(1, 8);
|
||||||
|
```
|
||||||
|
|
||||||
|
will run `BM_MultiThreaded` with thread counts 1, 2, 4, and 8.
|
||||||
|
|
||||||
If the benchmarked code itself uses threads and you want to compare it to
|
If the benchmarked code itself uses threads and you want to compare it to
|
||||||
single-threaded code, you may want to use real-time ("wallclock") measurements
|
single-threaded code, you may want to use real-time ("wallclock") measurements
|
||||||
for latency comparisons:
|
for latency comparisons:
|
||||||
|
Loading…
Reference in New Issue
Block a user