Index: base/process/process_metrics_linux.cc |
diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc |
index 7fa50922d572575206532ce1fee30d9235a58b72..0e12595f92efd10a76bf477bcebcd533257d385d 100644 |
--- a/base/process/process_metrics_linux.cc |
+++ b/base/process/process_metrics_linux.cc |
@@ -182,20 +182,16 @@ bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const { |
} |
double ProcessMetrics::GetCPUUsage() { |
- struct timeval now; |
- int retval = gettimeofday(&now, NULL); |
- if (retval) |
- return 0; |
- int64 time = TimeValToMicroseconds(now); |
+ TimeTicks time = TimeTicks::Now(); |
- if (last_cpu_time_ == 0) { |
+ if (last_cpu_ == 0) { |
// First call, just set the last values. |
last_cpu_time_ = time; |
last_cpu_ = GetProcessCPU(process_); |
return 0; |
} |
- int64 time_delta = time - last_cpu_time_; |
+ int64 time_delta = (time - last_cpu_time_).InMicroseconds(); |
DCHECK_NE(time_delta, 0); |
if (time_delta == 0) |
return 0; |
@@ -263,7 +259,6 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const { |
ProcessMetrics::ProcessMetrics(ProcessHandle process) |
: process_(process), |
- last_cpu_time_(0), |
last_system_time_(0), |
last_cpu_(0) { |
processor_count_ = base::SysInfo::NumberOfProcessors(); |