mirror of
https://gitee.com/openharmony/third_party_benchmark
synced 2024-11-23 07:20:12 +00:00
Documentation of basic use of DenseRange. (#855)
Documentation of basic use of `DenseRange` was added to README.md.
This commit is contained in:
parent
3523f11d36
commit
ffadb65d3a
1
AUTHORS
1
AUTHORS
@ -44,6 +44,7 @@ Ori Livneh <ori.livneh@gmail.com>
|
||||
Paul Redmond <paul.redmond@gmail.com>
|
||||
Radoslav Yovchev <radoslav.tm@gmail.com>
|
||||
Roman Lebedev <lebedev.ri@gmail.com>
|
||||
Sayan Bhattacharjee <aero.sayan@gmail.com>
|
||||
Shuo Chen <chenshuo@chenshuo.com>
|
||||
Steinar H. Gunderson <sgunderson@bigfoot.com>
|
||||
Stripe, Inc.
|
||||
|
@ -65,6 +65,7 @@ Raul Marin <rmrodriguez@cartodb.com>
|
||||
Ray Glover <ray.glover@uk.ibm.com>
|
||||
Robert Guo <robert.guo@mongodb.com>
|
||||
Roman Lebedev <lebedev.ri@gmail.com>
|
||||
Sayan Bhattacharjee <aero.sayan@gmail.com>
|
||||
Shuo Chen <chenshuo@chenshuo.com>
|
||||
Tobias Ulvgård <tobias.ulvgard@dirac.se>
|
||||
Tom Madams <tom.ej.madams@gmail.com> <tmadams@google.com>
|
||||
|
16
README.md
16
README.md
@ -422,6 +422,22 @@ BENCHMARK(BM_memcpy)->RangeMultiplier(2)->Range(8, 8<<10);
|
||||
```
|
||||
Now arguments generated are [ 8, 16, 32, 64, 128, 256, 512, 1024, 2k, 4k, 8k ].
|
||||
|
||||
The preceding code shows a method of defining a sparse range. The following
|
||||
example shows a method of defining a dense range. It is then used to benchmark
|
||||
the performance of `std::vector` initialization for uniformly increasing sizes.
|
||||
|
||||
```c++
|
||||
static void BM_DenseRange(benchmark::State& state) {
|
||||
for(auto _ : state) {
|
||||
std::vector<int> v(state.range(0), state.range(0));
|
||||
benchmark::DoNotOptimize(v.data());
|
||||
benchmark::ClobberMemory();
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_DenseRange)->DenseRange(0, 1024, 128);
|
||||
```
|
||||
Now arguments generated are [ 0, 128, 256, 384, 512, 640, 768, 896, 1024 ].
|
||||
|
||||
You might have a benchmark that depends on two or more inputs. For example, the
|
||||
following code defines a family of benchmarks for measuring the speed of set
|
||||
insertion.
|
||||
|
Loading…
Reference in New Issue
Block a user