mirror of
https://github.com/google/benchmark.git
synced 2025-01-13 21:30:14 +08:00
parent
1576991177
commit
ef88520d6f
@ -71,7 +71,7 @@ void BM_Complexity_O1(benchmark::State &state) {
|
||||
for (auto _ : state) {
|
||||
// This test requires a non-zero CPU time to avoid divide-by-zero
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
long tmp = state.iterations();
|
||||
double tmp = state.iterations();
|
||||
benchmark::DoNotOptimize(tmp);
|
||||
for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) {
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
@ -120,7 +120,7 @@ void BM_Complexity_O_N(benchmark::State &state) {
|
||||
for (auto _ : state) {
|
||||
// This test requires a non-zero CPU time to avoid divide-by-zero
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
long tmp = state.iterations();
|
||||
double tmp = state.iterations();
|
||||
benchmark::DoNotOptimize(tmp);
|
||||
for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) {
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
@ -129,7 +129,7 @@ void BM_Complexity_O_N(benchmark::State &state) {
|
||||
}
|
||||
|
||||
// 1ns per iteration per entry
|
||||
state.SetIterationTime(static_cast<double>(state.range(0)) * 42.0 * 1e-9);
|
||||
state.SetIterationTime(state.range(0) * 42 * 1e-9);
|
||||
}
|
||||
state.SetComplexityN(state.range(0));
|
||||
}
|
||||
@ -178,7 +178,7 @@ static void BM_Complexity_O_N_log_N(benchmark::State &state) {
|
||||
for (auto _ : state) {
|
||||
// This test requires a non-zero CPU time to avoid divide-by-zero
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
long tmp = state.iterations();
|
||||
double tmp = state.iterations();
|
||||
benchmark::DoNotOptimize(tmp);
|
||||
for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) {
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
@ -186,8 +186,8 @@ static void BM_Complexity_O_N_log_N(benchmark::State &state) {
|
||||
benchmark::DoNotOptimize(tmp);
|
||||
}
|
||||
|
||||
state.SetIterationTime(static_cast<double>(state.range(0)) * kLog2E *
|
||||
std::log(state.range(0)) * 42.0 * 1e-9);
|
||||
state.SetIterationTime(state.range(0) * kLog2E * std::log(state.range(0)) *
|
||||
42 * 1e-9);
|
||||
}
|
||||
state.SetComplexityN(state.range(0));
|
||||
}
|
||||
@ -238,7 +238,7 @@ void BM_ComplexityCaptureArgs(benchmark::State &state, int n) {
|
||||
for (auto _ : state) {
|
||||
// This test requires a non-zero CPU time to avoid divide-by-zero
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
long tmp = state.iterations();
|
||||
double tmp = state.iterations();
|
||||
benchmark::DoNotOptimize(tmp);
|
||||
for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) {
|
||||
benchmark::DoNotOptimize(state.iterations());
|
||||
@ -246,7 +246,7 @@ void BM_ComplexityCaptureArgs(benchmark::State &state, int n) {
|
||||
benchmark::DoNotOptimize(tmp);
|
||||
}
|
||||
|
||||
state.SetIterationTime(static_cast<double>(state.range(0)) * 42.0 * 1e-9);
|
||||
state.SetIterationTime(state.range(0) * 42 * 1e-9);
|
||||
}
|
||||
state.SetComplexityN(n);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user