diff options
author | 2016-10-21 18:18:29 -0700 | |
---|---|---|
committer | 2016-10-21 18:18:29 -0700 | |
commit | 60d55f80c4f0715b119213290b21767944dcda0f (patch) | |
tree | 2660f517859b1eb3a22d4bc2b83e315161cd571a /test/cpp/qps/usage_timer.cc | |
parent | c6c6cc269e49e4baacd7ed496983685f95c02f28 (diff) |
Change flag precision to flag stride, better description.
Add flag error_tolerence to define the search stopping criteria.
Move the equal condition in the binary search to smaller than condition.
Wrap get_cpu_usage(), so on non-linux platform, the compiler won't
complain and will get cpu usage to be 0.
Diffstat (limited to 'test/cpp/qps/usage_timer.cc')
-rw-r--r-- | test/cpp/qps/usage_timer.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/cpp/qps/usage_timer.cc b/test/cpp/qps/usage_timer.cc index 4821bdef7a..418378f942 100644 --- a/test/cpp/qps/usage_timer.cc +++ b/test/cpp/qps/usage_timer.cc @@ -53,6 +53,7 @@ static double time_double(struct timeval* tv) { static void get_cpu_usage(unsigned long long* total_cpu_time, unsigned long long* idle_cpu_time) { +#ifdef __linux__ std::ifstream proc_stat("/proc/stat"); proc_stat.ignore(5); std::string cpu_time_str; @@ -66,6 +67,9 @@ static void get_cpu_usage(unsigned long long* total_cpu_time, *idle_cpu_time = std::stol(cpu_time_str); } } +#else + gpr_log(GPR_INFO, "get_cpu_usage(): Non-linux platform is not supported."). +#endif } UsageTimer::Result UsageTimer::Sample() { |