You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in function BM_Histogram_Observe and some others, they use SetIterationTime to set the time cost manually, but did not call function UseManualTime, which means, the manual time cost won't print.
staticvoidBM_Histogram_Observe(benchmark::State& state) {
using prometheus::BuildHistogram;
using prometheus::Histogram;
using prometheus::Registry;
constauto number_of_buckets = state.range(0);
Registry registry;
auto& histogram_family =
BuildHistogram().Name("benchmark_histogram").Help("").Register(registry);
auto bucket_boundaries = CreateLinearBuckets(0, number_of_buckets - 1, 1);
auto& histogram = histogram_family.Add({}, bucket_boundaries);
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<> d(0, number_of_buckets);
while (state.KeepRunning()) {
auto observation = d(gen);
auto start = std::chrono::high_resolution_clock::now();
histogram.Observe(observation);
auto end = std::chrono::high_resolution_clock::now();
auto elapsed_seconds =
std::chrono::duration_cast<std::chrono::duration<double>>(end - start);
state.SetIterationTime(elapsed_seconds.count());
}
}
BENCHMARK(BM_Histogram_Observe)->Range(0, 4096)->UseManualTime(); // here
The text was updated successfully, but these errors were encountered:
in function
BM_Histogram_Observe
and some others, they useSetIterationTime
to set the time cost manually, but did not call functionUseManualTime
, which means, the manual time cost won't print.The text was updated successfully, but these errors were encountered: