aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/usage_timer.cc
diff options
context:
space:
mode:
authorGravatar Yuxuan Li <yuxuanli@google.com>2016-10-06 11:01:50 -0700
committerGravatar Yuxuan Li <yuxuanli@google.com>2016-10-06 15:06:01 -0700
commit49aeb5938918070e574a1eb0cf6fce1ca94e2b3a (patch)
tree094071ad0ba1aaa0b1393d14d9e8336517a55e57 /test/cpp/qps/usage_timer.cc
parentd31c78c6f05bc1e6e6ce307b43bd47993c8aead0 (diff)
clang-formated and latency_vs_load.cc is deleted as its functionality
has been merged into qps_json_driver.
Diffstat (limited to 'test/cpp/qps/usage_timer.cc')
-rw-r--r--test/cpp/qps/usage_timer.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/cpp/qps/usage_timer.cc b/test/cpp/qps/usage_timer.cc
index 589b78fd14..cbe5733e24 100644
--- a/test/cpp/qps/usage_timer.cc
+++ b/test/cpp/qps/usage_timer.cc
@@ -34,8 +34,8 @@
#include "test/cpp/qps/usage_timer.h"
#include <fstream>
-#include <string>
#include <sstream>
+#include <string>
#include <grpc/support/time.h>
#include <sys/resource.h>
@@ -52,20 +52,20 @@ static double time_double(struct timeval* tv) {
}
static void get_cpu_usage(unsigned long long* total_cpu_time,
- unsigned long long* idle_cpu_time) {
- std::ifstream proc_stat("/proc/stat");
- proc_stat.ignore(5);
- std::string cpu_time_str;
- std::string first_line;
- std::getline(proc_stat, first_line);
- std::stringstream first_line_s(first_line);
- for(int i = 0; i < 10; ++i) {
- std::getline(first_line_s, cpu_time_str, ' ');
- *total_cpu_time += std::stoi(cpu_time_str);
- if (i == 3) {
- *idle_cpu_time = std::stoi(cpu_time_str);
- }
- }
+ unsigned long long* idle_cpu_time) {
+ std::ifstream proc_stat("/proc/stat");
+ proc_stat.ignore(5);
+ std::string cpu_time_str;
+ std::string first_line;
+ std::getline(proc_stat, first_line);
+ std::stringstream first_line_s(first_line);
+ for (int i = 0; i < 10; ++i) {
+ std::getline(first_line_s, cpu_time_str, ' ');
+ *total_cpu_time += std::stoi(cpu_time_str);
+ if (i == 3) {
+ *idle_cpu_time = std::stoi(cpu_time_str);
+ }
+ }
}
UsageTimer::Result UsageTimer::Sample() {