| 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 #ifndef CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_GROUP_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_GROUP_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_GROUP_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_GROUP_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/memory_coordinator_client.h" | 15 #include "base/memory/memory_coordinator_client.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
| 18 #include "base/time/time.h" |
| 18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 19 #include "chrome/browser/task_manager/providers/task.h" | 20 #include "chrome/browser/task_manager/providers/task.h" |
| 20 #include "chrome/browser/task_manager/sampling/task_group_sampler.h" | 21 #include "chrome/browser/task_manager/sampling/task_group_sampler.h" |
| 21 #include "chrome/browser/task_manager/task_manager_observer.h" | 22 #include "chrome/browser/task_manager/task_manager_observer.h" |
| 22 | 23 |
| 23 namespace gpu { | 24 namespace gpu { |
| 24 struct VideoMemoryUsageStats; | 25 struct VideoMemoryUsageStats; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace task_manager { | 28 namespace task_manager { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool AreBackgroundCalculationsDone() const; | 62 bool AreBackgroundCalculationsDone() const; |
| 62 | 63 |
| 63 const base::ProcessHandle& process_handle() const { return process_handle_; } | 64 const base::ProcessHandle& process_handle() const { return process_handle_; } |
| 64 const base::ProcessId& process_id() const { return process_id_; } | 65 const base::ProcessId& process_id() const { return process_id_; } |
| 65 | 66 |
| 66 const std::vector<Task*>& tasks() const { return tasks_; } | 67 const std::vector<Task*>& tasks() const { return tasks_; } |
| 67 size_t num_tasks() const { return tasks().size(); } | 68 size_t num_tasks() const { return tasks().size(); } |
| 68 bool empty() const { return tasks().empty(); } | 69 bool empty() const { return tasks().empty(); } |
| 69 | 70 |
| 70 double cpu_usage() const { return cpu_usage_; } | 71 double cpu_usage() const { return cpu_usage_; } |
| 72 base::Time start_time() const { return start_time_; } |
| 73 base::TimeDelta cpu_time() const { return cpu_time_; } |
| 71 int64_t private_bytes() const { return memory_usage_.private_bytes; } | 74 int64_t private_bytes() const { return memory_usage_.private_bytes; } |
| 72 int64_t shared_bytes() const { return memory_usage_.shared_bytes; } | 75 int64_t shared_bytes() const { return memory_usage_.shared_bytes; } |
| 73 int64_t physical_bytes() const { return memory_usage_.physical_bytes; } | 76 int64_t physical_bytes() const { return memory_usage_.physical_bytes; } |
| 74 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
| 75 int64_t swapped_bytes() const { return memory_usage_.swapped_bytes; } | 78 int64_t swapped_bytes() const { return memory_usage_.swapped_bytes; } |
| 76 #endif | 79 #endif |
| 77 int64_t gpu_memory() const { return gpu_memory_; } | 80 int64_t gpu_memory() const { return gpu_memory_; } |
| 78 bool gpu_memory_has_duplicates() const { return gpu_memory_has_duplicates_; } | 81 bool gpu_memory_has_duplicates() const { return gpu_memory_has_duplicates_; } |
| 79 base::MemoryState memory_state() const { return memory_state_; } | 82 base::MemoryState memory_state() const { return memory_state_; } |
| 80 int64_t per_process_network_usage() const { | 83 int64_t per_process_network_usage() const { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 102 private: | 105 private: |
| 103 void RefreshGpuMemory(const gpu::VideoMemoryUsageStats& gpu_memory_stats); | 106 void RefreshGpuMemory(const gpu::VideoMemoryUsageStats& gpu_memory_stats); |
| 104 | 107 |
| 105 void RefreshWindowsHandles(); | 108 void RefreshWindowsHandles(); |
| 106 | 109 |
| 107 // |child_process_unique_id| see Task::GetChildProcessUniqueID(). | 110 // |child_process_unique_id| see Task::GetChildProcessUniqueID(). |
| 108 void RefreshNaClDebugStubPort(int child_process_unique_id); | 111 void RefreshNaClDebugStubPort(int child_process_unique_id); |
| 109 | 112 |
| 110 void OnCpuRefreshDone(double cpu_usage); | 113 void OnCpuRefreshDone(double cpu_usage); |
| 111 | 114 |
| 115 void OnStartTimeRefreshDone(base::Time start_time); |
| 116 |
| 117 void OnCpuTimeRefreshDone(base::TimeDelta cpu_time); |
| 118 |
| 112 void OnPhysicalMemoryUsageRefreshDone(int64_t physical_bytes); | 119 void OnPhysicalMemoryUsageRefreshDone(int64_t physical_bytes); |
| 113 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage); | 120 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage); |
| 114 | 121 |
| 115 void OnIdleWakeupsRefreshDone(int idle_wakeups_per_second); | 122 void OnIdleWakeupsRefreshDone(int idle_wakeups_per_second); |
| 116 | 123 |
| 117 #if defined(OS_LINUX) | 124 #if defined(OS_LINUX) |
| 118 void OnOpenFdCountRefreshDone(int open_fd_count); | 125 void OnOpenFdCountRefreshDone(int open_fd_count); |
| 119 #endif // defined(OS_LINUX) | 126 #endif // defined(OS_LINUX) |
| 120 | 127 |
| 121 void OnProcessPriorityDone(bool is_backgrounded); | 128 void OnProcessPriorityDone(bool is_backgrounded); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 138 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders. | 145 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders. |
| 139 std::vector<Task*> tasks_; | 146 std::vector<Task*> tasks_; |
| 140 | 147 |
| 141 // Flags will be used to determine when the background calculations has | 148 // Flags will be used to determine when the background calculations has |
| 142 // completed for the enabled refresh types for this TaskGroup. | 149 // completed for the enabled refresh types for this TaskGroup. |
| 143 int64_t expected_on_bg_done_flags_; | 150 int64_t expected_on_bg_done_flags_; |
| 144 int64_t current_on_bg_done_flags_; | 151 int64_t current_on_bg_done_flags_; |
| 145 | 152 |
| 146 // The per process resources usages. | 153 // The per process resources usages. |
| 147 double cpu_usage_; | 154 double cpu_usage_; |
| 155 base::Time start_time_; // Only calculated On Windows now. |
| 156 base::TimeDelta cpu_time_; // Only calculated On Windows now. |
| 148 MemoryUsageStats memory_usage_; | 157 MemoryUsageStats memory_usage_; |
| 149 int64_t gpu_memory_; | 158 int64_t gpu_memory_; |
| 150 base::MemoryState memory_state_; | 159 base::MemoryState memory_state_; |
| 151 // The network usage in bytes per second as the sum of all network usages of | 160 // The network usage in bytes per second as the sum of all network usages of |
| 152 // the individual tasks sharing the same process. | 161 // the individual tasks sharing the same process. |
| 153 int64_t per_process_network_usage_; | 162 int64_t per_process_network_usage_; |
| 154 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
| 155 // Windows GDI and USER Handles. | 164 // Windows GDI and USER Handles. |
| 156 int64_t gdi_current_handles_; | 165 int64_t gdi_current_handles_; |
| 157 int64_t gdi_peak_handles_; | 166 int64_t gdi_peak_handles_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 172 // Always keep this the last member of this class so that it's the first to be | 181 // Always keep this the last member of this class so that it's the first to be |
| 173 // destroyed. | 182 // destroyed. |
| 174 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; | 183 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; |
| 175 | 184 |
| 176 DISALLOW_COPY_AND_ASSIGN(TaskGroup); | 185 DISALLOW_COPY_AND_ASSIGN(TaskGroup); |
| 177 }; | 186 }; |
| 178 | 187 |
| 179 } // namespace task_manager | 188 } // namespace task_manager |
| 180 | 189 |
| 181 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_GROUP_H_ | 190 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_TASK_GROUP_H_ |
| OLD | NEW |