OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/task_manager/sampling/task_group.h" | 5 #include "chrome/browser/task_manager/sampling/task_group.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 process_id_(proc_id), | 85 process_id_(proc_id), |
86 on_background_calculations_done_(on_background_calculations_done), | 86 on_background_calculations_done_(on_background_calculations_done), |
87 worker_thread_sampler_(nullptr), | 87 worker_thread_sampler_(nullptr), |
88 shared_sampler_(shared_sampler), | 88 shared_sampler_(shared_sampler), |
89 expected_on_bg_done_flags_(kBackgroundRefreshTypesMask), | 89 expected_on_bg_done_flags_(kBackgroundRefreshTypesMask), |
90 current_on_bg_done_flags_(0), | 90 current_on_bg_done_flags_(0), |
91 cpu_usage_(0.0), | 91 cpu_usage_(0.0), |
92 gpu_memory_(-1), | 92 gpu_memory_(-1), |
93 memory_state_(base::MemoryState::UNKNOWN), | 93 memory_state_(base::MemoryState::UNKNOWN), |
94 per_process_network_usage_(-1), | 94 per_process_network_usage_(-1), |
| 95 total_per_process_network_usage_(0), |
95 #if defined(OS_WIN) | 96 #if defined(OS_WIN) |
96 gdi_current_handles_(-1), | 97 gdi_current_handles_(-1), |
97 gdi_peak_handles_(-1), | 98 gdi_peak_handles_(-1), |
98 user_current_handles_(-1), | 99 user_current_handles_(-1), |
99 user_peak_handles_(-1), | 100 user_peak_handles_(-1), |
100 #endif // defined(OS_WIN) | 101 #endif // defined(OS_WIN) |
101 #if !defined(DISABLE_NACL) | 102 #if !defined(DISABLE_NACL) |
102 nacl_debug_stub_port_(nacl::kGdbDebugStubPortUnknown), | 103 nacl_debug_stub_port_(nacl::kGdbDebugStubPortUnknown), |
103 #endif // !defined(DISABLE_NACL) | 104 #endif // !defined(DISABLE_NACL) |
104 idle_wakeups_per_second_(-1), | 105 idle_wakeups_per_second_(-1), |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 163 |
163 // First refresh the enabled non-expensive resources usages on the UI thread. | 164 // First refresh the enabled non-expensive resources usages on the UI thread. |
164 // 1- Refresh all the tasks as well as the total network usage (if enabled). | 165 // 1- Refresh all the tasks as well as the total network usage (if enabled). |
165 const bool network_usage_refresh_enabled = | 166 const bool network_usage_refresh_enabled = |
166 TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_NETWORK_USAGE, | 167 TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_NETWORK_USAGE, |
167 refresh_flags); | 168 refresh_flags); |
168 per_process_network_usage_ = network_usage_refresh_enabled ? 0 : -1; | 169 per_process_network_usage_ = network_usage_refresh_enabled ? 0 : -1; |
169 for (Task* task : tasks_) { | 170 for (Task* task : tasks_) { |
170 task->Refresh(update_interval, refresh_flags); | 171 task->Refresh(update_interval, refresh_flags); |
171 | 172 |
172 if (network_usage_refresh_enabled && task->ReportsNetworkUsage()) | 173 if (network_usage_refresh_enabled && task->ReportsNetworkUsage()) { |
173 per_process_network_usage_ += task->network_usage(); | 174 per_process_network_usage_ += task->network_usage(); |
| 175 total_per_process_network_usage_ += task->total_network_usage(); |
| 176 } |
174 } | 177 } |
175 | 178 |
176 // 2- Refresh GPU memory (if enabled). | 179 // 2- Refresh GPU memory (if enabled). |
177 if (TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_GPU_MEMORY, | 180 if (TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_GPU_MEMORY, |
178 refresh_flags)) { | 181 refresh_flags)) { |
179 RefreshGpuMemory(gpu_memory_stats); | 182 RefreshGpuMemory(gpu_memory_stats); |
180 } | 183 } |
181 | 184 |
182 // 3- Refresh Windows handles (if enabled). | 185 // 3- Refresh Windows handles (if enabled). |
183 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 354 |
352 void TaskGroup::OnBackgroundRefreshTypeFinished(int64_t finished_refresh_type) { | 355 void TaskGroup::OnBackgroundRefreshTypeFinished(int64_t finished_refresh_type) { |
353 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 356 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
354 | 357 |
355 current_on_bg_done_flags_ |= finished_refresh_type; | 358 current_on_bg_done_flags_ |= finished_refresh_type; |
356 if (AreBackgroundCalculationsDone()) | 359 if (AreBackgroundCalculationsDone()) |
357 on_background_calculations_done_.Run(); | 360 on_background_calculations_done_.Run(); |
358 } | 361 } |
359 | 362 |
360 } // namespace task_manager | 363 } // namespace task_manager |
OLD | NEW |