blob: 86c751a7bb38e33ea985cd7e4d3c4217209f38b4 (
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
42
43
44
45
46
47
48
49
50
|
#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_GetInstant(benchmark::State& state)
{
for (auto _ : state) {
benchmark::DoNotOptimize(GetInstant());
}
}
BENCHMARK(BM_GetInstant);
void BM_InstantNow(benchmark::State& state)
{
for (auto _ : state) {
benchmark::DoNotOptimize(TInstant::Now());
}
}
BENCHMARK(BM_InstantNow);
////////////////////////////////////////////////////////////////////////////////
} // namespace
} // namespace NYT
|