| 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_MANAGEMENT_SAMPLING_TASK_GROUP_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 size_t num_tasks() const { return tasks_.size(); } | 48 size_t num_tasks() const { return tasks_.size(); } |
| 49 bool empty() const { return tasks_.empty(); } | 49 bool empty() const { return tasks_.empty(); } |
| 50 | 50 |
| 51 double cpu_usage() const { return cpu_usage_; } | 51 double cpu_usage() const { return cpu_usage_; } |
| 52 int64 private_bytes() const { return memory_usage_.private_bytes; } | 52 int64 private_bytes() const { return memory_usage_.private_bytes; } |
| 53 int64 shared_bytes() const { return memory_usage_.shared_bytes; } | 53 int64 shared_bytes() const { return memory_usage_.shared_bytes; } |
| 54 int64 physical_bytes() const { return memory_usage_.physical_bytes; } | 54 int64 physical_bytes() const { return memory_usage_.physical_bytes; } |
| 55 int64 gpu_memory() const { return gpu_memory_; } | 55 int64 gpu_memory() const { return gpu_memory_; } |
| 56 bool gpu_memory_has_duplicates() const { return gpu_memory_has_duplicates_; } | 56 bool gpu_memory_has_duplicates() const { return gpu_memory_has_duplicates_; } |
| 57 int64 per_process_network_usage() const { return per_process_network_usage_; } | 57 int64 per_process_network_usage() const { return per_process_network_usage_; } |
| 58 bool is_backgrounded() const { return is_backgrounded_; } |
| 58 | 59 |
| 59 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 60 int64 gdi_current_handles() const { return gdi_current_handles_; } | 61 int64 gdi_current_handles() const { return gdi_current_handles_; } |
| 61 int64 gdi_peak_handles() const { return gdi_peak_handles_; } | 62 int64 gdi_peak_handles() const { return gdi_peak_handles_; } |
| 62 int64 user_current_handles() const { return user_current_handles_; } | 63 int64 user_current_handles() const { return user_current_handles_; } |
| 63 int64 user_peak_handles() const { return user_peak_handles_; } | 64 int64 user_peak_handles() const { return user_peak_handles_; } |
| 64 #endif // defined(OS_WIN) | 65 #endif // defined(OS_WIN) |
| 65 | 66 |
| 66 #if !defined(DISABLE_NACL) | 67 #if !defined(DISABLE_NACL) |
| 67 int nacl_debug_stub_port() const { return nacl_debug_stub_port_; } | 68 int nacl_debug_stub_port() const { return nacl_debug_stub_port_; } |
| 68 #endif // !defined(DISABLE_NACL) | 69 #endif // !defined(DISABLE_NACL) |
| 69 | 70 |
| 70 int idle_wakeups_per_second() const { return idle_wakeups_per_second_; } | 71 int idle_wakeups_per_second() const { return idle_wakeups_per_second_; } |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 void RefreshGpuMemory( | 74 void RefreshGpuMemory( |
| 74 const content::GPUVideoMemoryUsageStats& gpu_memory_stats); | 75 const content::GPUVideoMemoryUsageStats& gpu_memory_stats); |
| 75 | 76 |
| 76 void RefreshWindowsHandles(); | 77 void RefreshWindowsHandles(); |
| 77 | 78 |
| 78 // |child_process_unique_id| see Task::GetChildProcessUniqueID(). | 79 // |child_process_unique_id| see Task::GetChildProcessUniqueID(). |
| 79 void RefreshNaClDebugStubPort(int child_process_unique_id); | 80 void RefreshNaClDebugStubPort(int child_process_unique_id); |
| 80 | 81 |
| 81 void OnCpuRefreshDone(double cpu_usage); | 82 void OnCpuRefreshDone(double cpu_usage); |
| 82 | 83 |
| 83 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage); | 84 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage); |
| 84 | 85 |
| 85 void OnIdleWakeupsRefreshDone(int idle_wakeups_per_second); | 86 void OnIdleWakeupsRefreshDone(int idle_wakeups_per_second); |
| 86 | 87 |
| 88 void OnProcessPriorityDone(bool is_backgrounded); |
| 89 |
| 87 // The process' handle and ID. | 90 // The process' handle and ID. |
| 88 base::ProcessHandle process_handle_; | 91 base::ProcessHandle process_handle_; |
| 89 base::ProcessId process_id_; | 92 base::ProcessId process_id_; |
| 90 | 93 |
| 91 scoped_refptr<TaskGroupSampler> worker_thread_sampler_; | 94 scoped_refptr<TaskGroupSampler> worker_thread_sampler_; |
| 92 | 95 |
| 93 // Maps the Tasks by their IDs. | 96 // Maps the Tasks by their IDs. |
| 94 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders. | 97 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders. |
| 95 std::map<TaskId, Task*> tasks_; | 98 std::map<TaskId, Task*> tasks_; |
| 96 | 99 |
| 97 // The per process resources usages. | 100 // The per process resources usages. |
| 98 double cpu_usage_; | 101 double cpu_usage_; |
| 99 MemoryUsageStats memory_usage_; | 102 MemoryUsageStats memory_usage_; |
| 100 int64 gpu_memory_; | 103 int64 gpu_memory_; |
| 101 // The network usage in bytes per second as the sum of all network usages of | 104 // The network usage in bytes per second as the sum of all network usages of |
| 102 // the individual tasks sharing the same process. | 105 // the individual tasks sharing the same process. |
| 103 int64 per_process_network_usage_; | 106 int64 per_process_network_usage_; |
| 104 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
| 105 // Windows GDI and USER Handles. | 108 // Windows GDI and USER Handles. |
| 106 int64 gdi_current_handles_; | 109 int64 gdi_current_handles_; |
| 107 int64 gdi_peak_handles_; | 110 int64 gdi_peak_handles_; |
| 108 int64 user_current_handles_; | 111 int64 user_current_handles_; |
| 109 int64 user_peak_handles_; | 112 int64 user_peak_handles_; |
| 110 #endif // defined(OS_WIN) | 113 #endif // defined(OS_WIN) |
| 111 #if !defined(DISABLE_NACL) | 114 #if !defined(DISABLE_NACL) |
| 112 int nacl_debug_stub_port_; | 115 int nacl_debug_stub_port_; |
| 113 #endif // !defined(DISABLE_NACL) | 116 #endif // !defined(DISABLE_NACL) |
| 114 int idle_wakeups_per_second_; | 117 int idle_wakeups_per_second_; |
| 115 bool gpu_memory_has_duplicates_; | 118 bool gpu_memory_has_duplicates_; |
| 119 bool is_backgrounded_; |
| 116 | 120 |
| 117 // Always keep this the last member of this class so that it's the first to be | 121 // Always keep this the last member of this class so that it's the first to be |
| 118 // destroyed. | 122 // destroyed. |
| 119 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; | 123 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; |
| 120 | 124 |
| 121 DISALLOW_COPY_AND_ASSIGN(TaskGroup); | 125 DISALLOW_COPY_AND_ASSIGN(TaskGroup); |
| 122 }; | 126 }; |
| 123 | 127 |
| 124 } // namespace task_management | 128 } // namespace task_management |
| 125 | 129 |
| 126 | 130 |
| 127 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ | 131 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ |
| OLD | NEW |