| namespace benchmark { | |
| // Return the CPU usage of the current process | |
| double ProcessCPUUsage(); | |
| // Return the CPU usage of the children of the current process | |
| double ChildrenCPUUsage(); | |
| // Return the CPU usage of the current thread | |
| double ThreadCPUUsage(); | |
| template <bool HighResIsSteady = std::chrono::high_resolution_clock::is_steady> | |
| struct ChooseSteadyClock { | |
| typedef std::chrono::high_resolution_clock type; | |
| }; | |
| template <> | |
| struct ChooseSteadyClock<false> { | |
| typedef std::chrono::steady_clock type; | |
| }; | |
| struct ChooseClockType { | |
| typedef ChooseSteadyClock<>::type type; | |
| typedef std::chrono::high_resolution_clock type; | |
| }; | |
| inline double ChronoClockNow() { | |
| typedef ChooseClockType::type ClockType; | |
| using FpSeconds = std::chrono::duration<double, std::chrono::seconds::period>; | |
| return FpSeconds(ClockType::now().time_since_epoch()).count(); | |
| } | |
| std::string LocalDateTimeString(); | |
| } // end namespace benchmark | |