/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/yt/cpu_clock/benchmark/benchmark.cpp
50 строк
1021 B
Anton Myagkov
Update ydb version to 24.4 (#4579)
07 фев 2026, 11:59
Не верифицирован
07 фев 2026, 11:59
2c21cae
Код
Авторство
О чём код?
#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