mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
407c817d7a
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
45 lines
1.1 KiB
C++
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();
|