1 #ifndef BENCHMARK_TIMERS_H 2 #define BENCHMARK_TIMERS_H 10 double ProcessCPUUsage();
13 double ChildrenCPUUsage();
16 double ThreadCPUUsage();
18 #if defined(BENCHMARK_OS_QURT) 27 typedef std::ratio<1, 19200000> period;
28 typedef std::chrono::duration<rep, period> duration;
29 typedef std::chrono::time_point<QuRTClock> time_point;
30 static const bool is_steady =
false;
32 static time_point now() {
33 unsigned long long count;
34 asm volatile(
" %0 = c31:30 " :
"=r"(count));
35 return time_point(static_cast<duration>(count));
41 #if defined(HAVE_STEADY_CLOCK) 42 template <
bool HighResIsSteady = std::chrono::high_resolution_clock::is_steady>
43 struct ChooseSteadyClock {
44 typedef std::chrono::high_resolution_clock type;
48 struct ChooseSteadyClock<false> {
49 typedef std::chrono::steady_clock type;
51 #endif // HAVE_STEADY_CLOCK 56 #if defined(BENCHMARK_OS_QURT) 57 typedef QuRTClock type;
58 #elif defined(HAVE_STEADY_CLOCK) 59 typedef ChooseSteadyClock<>::type type;
61 typedef std::chrono::high_resolution_clock type;
65 inline double ChronoClockNow() {
66 typedef ChooseClockType::type ClockType;
67 using FpSeconds = std::chrono::duration<double, std::chrono::seconds::period>;
68 return FpSeconds(ClockType::now().time_since_epoch()).count();
71 std::string LocalDateTimeString();
75 #endif // BENCHMARK_TIMERS_H
Definition: benchmark.h:338