sapling/eden/fs/telemetry/test/TracingBenchmark.cpp
Chad Austin 407c817d7a switch from folly benchmark to google benchmark
Summary:
Google Benchmark is easier to use, has more built-in functionality,
and more accurate default behavior than Folly Benchmark, so switch
EdenFS to use it.;

Reviewed By: simpkins

Differential Revision: D20273672

fbshipit-source-id: c90c49878592620a83d2821ed4bc75c20e599a75
2020-04-30 09:36:01 -07:00

45 lines
1.1 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#include <benchmark/benchmark.h>
#include <folly/init/Init.h>
#include <folly/synchronization/test/Barrier.h>
#include "eden/fs/benchharness/Bench.h"
#include "eden/fs/telemetry/Tracing.h"
using namespace facebook::eden;
static void Tracer_repeatedly_create_trace_points(benchmark::State& state) {
enableTracing();
for (auto _ : state) {
TraceBlock block{"foo"};
}
}
BENCHMARK(Tracer_repeatedly_create_trace_points);
static void Tracer_repeatedly_create_trace_points_from_multiple_threads(
benchmark::State& state) {
enableTracing();
for (auto _ : state) {
TraceBlock block{"foo"};
}
}
BENCHMARK(Tracer_repeatedly_create_trace_points_from_multiple_threads)
->Threads(8);
static void Tracer_repeatedly_create_trace_points_disabled(
benchmark::State& state) {
disableTracing();
for (auto _ : state) {
TraceBlock block{"foo"};
}
}
BENCHMARK(Tracer_repeatedly_create_trace_points_disabled);
BENCHMARK_MAIN();