| 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_manager_impl.h" | 5 #include "chrome/browser/task_manager/sampling/task_manager_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 | 87 |
| 88 void TaskManagerImpl::KillTask(TaskId task_id) { | 88 void TaskManagerImpl::KillTask(TaskId task_id) { |
| 89 GetTaskByTaskId(task_id)->Kill(); | 89 GetTaskByTaskId(task_id)->Kill(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 double TaskManagerImpl::GetCpuUsage(TaskId task_id) const { | 92 double TaskManagerImpl::GetCpuUsage(TaskId task_id) const { |
| 93 return GetTaskGroupByTaskId(task_id)->cpu_usage(); | 93 return GetTaskGroupByTaskId(task_id)->cpu_usage(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 base::Time TaskManagerImpl::GetStartTime(TaskId task_id) const { |
| 97 #if defined(OS_WIN) |
| 98 return GetTaskGroupByTaskId(task_id)->start_time(); |
| 99 #else |
| 100 NOTIMPLEMENTED(); |
| 101 return base::Time(); |
| 102 #endif |
| 103 } |
| 104 |
| 105 base::TimeDelta TaskManagerImpl::GetCpuTime(TaskId task_id) const { |
| 106 #if defined(OS_WIN) |
| 107 return GetTaskGroupByTaskId(task_id)->cpu_time(); |
| 108 #else |
| 109 NOTIMPLEMENTED(); |
| 110 return base::TimeDelta(); |
| 111 #endif |
| 112 } |
| 113 |
| 96 int64_t TaskManagerImpl::GetPhysicalMemoryUsage(TaskId task_id) const { | 114 int64_t TaskManagerImpl::GetPhysicalMemoryUsage(TaskId task_id) const { |
| 97 return GetTaskGroupByTaskId(task_id)->physical_bytes(); | 115 return GetTaskGroupByTaskId(task_id)->physical_bytes(); |
| 98 } | 116 } |
| 99 | 117 |
| 100 int64_t TaskManagerImpl::GetPrivateMemoryUsage(TaskId task_id) const { | 118 int64_t TaskManagerImpl::GetPrivateMemoryUsage(TaskId task_id) const { |
| 101 return GetTaskGroupByTaskId(task_id)->private_bytes(); | 119 return GetTaskGroupByTaskId(task_id)->private_bytes(); |
| 102 } | 120 } |
| 103 | 121 |
| 104 int64_t TaskManagerImpl::GetSharedMemoryUsage(TaskId task_id) const { | 122 int64_t TaskManagerImpl::GetSharedMemoryUsage(TaskId task_id) const { |
| 105 return GetTaskGroupByTaskId(task_id)->shared_bytes(); | 123 return GetTaskGroupByTaskId(task_id)->shared_bytes(); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 groups_itr.second->AreBackgroundCalculationsDone(); | 562 groups_itr.second->AreBackgroundCalculationsDone(); |
| 545 } | 563 } |
| 546 if (are_all_processes_data_ready) { | 564 if (are_all_processes_data_ready) { |
| 547 NotifyObserversOnRefreshWithBackgroundCalculations(GetTaskIdsList()); | 565 NotifyObserversOnRefreshWithBackgroundCalculations(GetTaskIdsList()); |
| 548 for (const auto& groups_itr : task_groups_by_proc_id_) | 566 for (const auto& groups_itr : task_groups_by_proc_id_) |
| 549 groups_itr.second->ClearCurrentBackgroundCalculationsFlags(); | 567 groups_itr.second->ClearCurrentBackgroundCalculationsFlags(); |
| 550 } | 568 } |
| 551 } | 569 } |
| 552 | 570 |
| 553 } // namespace task_manager | 571 } // namespace task_manager |
| OLD | NEW |