Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: third_party/google_benchmark/src/timers.h

Issue 2865663003: Adding Google benchmarking library. (Closed)
Patch Set: Sketch. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/google_benchmark/src/sysinfo.cc ('k') | third_party/google_benchmark/src/timers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
30 struct ChooseClockType {
31 #if defined(HAVE_STEADY_CLOCK)
32 typedef ChooseSteadyClock<>::type type;
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
44 std::string LocalDateTimeString();
45
46 } // end namespace benchmark
47
48 #endif // BENCHMARK_TIMERS_H
OLDNEW
« no previous file with comments | « third_party/google_benchmark/src/sysinfo.cc ('k') | third_party/google_benchmark/src/timers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698