blob: 9d300b6726e89ff01da64ecb21736db62df8c6c2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "benchmark/benchmark.h"
#include <benchmark/benchmark.h>
#include <library/cpp/yt/cpu_clock/clock.h>
namespace NYT {
namespace {
////////////////////////////////////////////////////////////////////////////////
void BM_GetCpuInstant(benchmark::State& state)
{
for (auto _ : state) {
benchmark::DoNotOptimize(GetCpuInstant());
}
}
BENCHMARK(BM_GetCpuInstant);
void BM_GetCpuApproximateInstant(benchmark::State& state)
{
for (auto _ : state) {
benchmark::DoNotOptimize(GetApproximateCpuInstant());
}
}
BENCHMARK(BM_GetCpuApproximateInstant);
void BM_InstantNow(benchmark::State& state)
{
for (auto _ : state) {
benchmark::DoNotOptimize(TInstant::Now());
}
}
BENCHMARK(BM_InstantNow);
////////////////////////////////////////////////////////////////////////////////
} // namespace
} // namespace NYT
|