third_party/benchmark/src/timers.h
Go to the documentation of this file.
1 #ifndef BENCHMARK_TIMERS_H
2 #define BENCHMARK_TIMERS_H
3 
4 #include <chrono>
5 #include <string>
6 
7 namespace benchmark {
8 
9 // Return the CPU usage of the current process
10 double ProcessCPUUsage();
11 
12 // Return the CPU usage of the children of the current process
13 double ChildrenCPUUsage();
14 
15 // Return the CPU usage of the current thread
16 double ThreadCPUUsage();
17 
18 #if defined(HAVE_STEADY_CLOCK)
19 template <bool HighResIsSteady = std::chrono::high_resolution_clock::is_steady>
20 struct ChooseSteadyClock {
21  typedef std::chrono::high_resolution_clock type;
22 };
23 
24 template <>
25 struct ChooseSteadyClock<false> {
26  typedef std::chrono::steady_clock type;
27 };
28 #endif
29 
31 #if defined(HAVE_STEADY_CLOCK)
33 #else
34  typedef std::chrono::high_resolution_clock type;
35 #endif
36 };
37 
38 inline double ChronoClockNow() {
39  typedef ChooseClockType::type ClockType;
40  using FpSeconds = std::chrono::duration<double, std::chrono::seconds::period>;
41  return FpSeconds(ClockType::now().time_since_epoch()).count();
42 }
43 
45 
46 } // end namespace benchmark
47 
48 #endif // BENCHMARK_TIMERS_H
benchmark::ProcessCPUUsage
double ProcessCPUUsage()
Definition: benchmark/src/timers.cc:110
now
static double now(void)
Definition: test/core/fling/client.cc:130
benchmark
Definition: bm_alarm.cc:55
false
#define false
Definition: setup_once.h:323
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
benchmark::ChooseClockType
Definition: third_party/benchmark/src/timers.h:30
benchmark::ChronoClockNow
double ChronoClockNow()
Definition: third_party/benchmark/src/timers.h:38
benchmark::ThreadCPUUsage
double ThreadCPUUsage()
Definition: benchmark/src/timers.cc:141
benchmark::ChooseClockType::type
std::chrono::high_resolution_clock type
Definition: third_party/benchmark/src/timers.h:34
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
benchmark::LocalDateTimeString
std::string LocalDateTimeString()
Definition: benchmark/src/timers.cc:182
benchmark::ChildrenCPUUsage
double ChildrenCPUUsage()


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:38