diff options
| author | chai <chaifix@163.com> | 2021-12-01 13:34:22 +0800 |
|---|---|---|
| committer | chai <chaifix@163.com> | 2021-12-01 13:34:22 +0800 |
| commit | 09abf1b529b4226f585ecfbb20866715b901755b (patch) | |
| tree | 16929f2a6bee3ad4667bdd006cfcc1e683ab7210 /Client/ThirdParty/fpm/3rdparty/googlebench/src/timers.h | |
| parent | 84d961f754c905b37420f4d1b3fee8f4e523e58a (diff) | |
+fpm
Diffstat (limited to 'Client/ThirdParty/fpm/3rdparty/googlebench/src/timers.h')
| -rw-r--r-- | Client/ThirdParty/fpm/3rdparty/googlebench/src/timers.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Client/ThirdParty/fpm/3rdparty/googlebench/src/timers.h b/Client/ThirdParty/fpm/3rdparty/googlebench/src/timers.h new file mode 100644 index 0000000..65606cc --- /dev/null +++ b/Client/ThirdParty/fpm/3rdparty/googlebench/src/timers.h @@ -0,0 +1,48 @@ +#ifndef BENCHMARK_TIMERS_H +#define BENCHMARK_TIMERS_H + +#include <chrono> +#include <string> + +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(); + +#if defined(HAVE_STEADY_CLOCK) +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; +}; +#endif + +struct ChooseClockType { +#if defined(HAVE_STEADY_CLOCK) + typedef ChooseSteadyClock<>::type type; +#else + typedef std::chrono::high_resolution_clock type; +#endif +}; + +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 + +#endif // BENCHMARK_TIMERS_H |
