Chromium Code Reviews| Index: chrome/browser/task_manager/sampling/task_group.cc |
| diff --git a/chrome/browser/task_manager/sampling/task_group.cc b/chrome/browser/task_manager/sampling/task_group.cc |
| index 5e36d732e9aa5ba72c47acae6b1f78d2347114f9..dc5f89f3ca805f265258d786543826c49a880c43 100644 |
| --- a/chrome/browser/task_manager/sampling/task_group.cc |
| +++ b/chrome/browser/task_manager/sampling/task_group.cc |
| @@ -25,6 +25,8 @@ const int kBackgroundRefreshTypesMask = |
| REFRESH_TYPE_CPU | |
| REFRESH_TYPE_MEMORY | |
| REFRESH_TYPE_IDLE_WAKEUPS | |
| + REFRESH_TYPE_START_TIME | |
| + REFRESH_TYPE_CPU_TIME | |
| #if defined(OS_LINUX) |
| REFRESH_TYPE_FD_COUNT | |
| #endif // defined(OS_LINUX) |
| @@ -76,6 +78,8 @@ TaskGroup::TaskGroup( |
| expected_on_bg_done_flags_(kBackgroundRefreshTypesMask), |
| current_on_bg_done_flags_(0), |
| cpu_usage_(0.0), |
| + start_time_(0), |
| + cpu_time_(0), |
| gpu_memory_(-1), |
| per_process_network_usage_(-1), |
| #if defined(OS_WIN) |
| @@ -115,6 +119,10 @@ TaskGroup::TaskGroup( |
| process_id_, base::Bind(&TaskGroup::OnIdleWakeupsRefreshDone, |
| weak_ptr_factory_.GetWeakPtr()), |
| base::Bind(&TaskGroup::OnPhysicalMemoryUsageRefreshDone, |
| + weak_ptr_factory_.GetWeakPtr()), |
| + base::Bind(&TaskGroup::OnStartTimeRefreshDone, |
| + weak_ptr_factory_.GetWeakPtr()), |
| + base::Bind(&TaskGroup::OnCpuTimeRefreshDone, |
| weak_ptr_factory_.GetWeakPtr())); |
| } |
| @@ -191,10 +199,12 @@ void TaskGroup::Refresh(const gpu::VideoMemoryUsageStats& gpu_memory_stats, |
| // The remaining resource refreshes are time consuming and cannot be done on |
| // the UI thread. Do them all on the worker thread using the TaskGroupSampler. |
| // 6- CPU usage. |
| - // 7- Memory usage. |
| - // 8- Idle Wakeups per second. |
| - // 9- (Linux and ChromeOS only) The number of file descriptors current open. |
| - // 10- Process priority (foreground vs. background). |
| + // 7- Start time. |
|
stanisc
2016/12/19 22:44:10
This is misleading because TaskGroupSampler doesn'
chengx
2016/12/20 00:51:12
I reverted the change.
|
| + // 8- CPU time. |
| + // 9- Memory usage. |
| + // 10- Idle Wakeups per second. |
| + // 11- (Linux and ChromeOS only) The number of file descriptors current open. |
| + // 12- Process priority (foreground vs. background). |
| worker_thread_sampler_->Refresh(refresh_flags); |
| } |
| @@ -253,6 +263,20 @@ void TaskGroup::OnCpuRefreshDone(double cpu_usage) { |
| OnBackgroundRefreshTypeFinished(REFRESH_TYPE_CPU); |
| } |
| +void TaskGroup::OnStartTimeRefreshDone(int64_t start_time) { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| + |
| + start_time_ = start_time; |
| + OnBackgroundRefreshTypeFinished(REFRESH_TYPE_START_TIME); |
| +} |
| + |
| +void TaskGroup::OnCpuTimeRefreshDone(int64_t cpu_time) { |
| + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| + |
| + cpu_time_ = cpu_time; |
| + OnBackgroundRefreshTypeFinished(REFRESH_TYPE_CPU_TIME); |
| +} |
| + |
| void TaskGroup::OnPhysicalMemoryUsageRefreshDone(int64_t physical_bytes) { |
| #if defined(OS_WIN) |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |