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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/process/process_handle.h" | 15 #include "base/process/process_handle.h" |
16 #include "base/process/process_metrics.h" | 16 #include "base/process/process_metrics.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/browser/task_management/providers/task.h" | 18 #include "chrome/browser/task_management/providers/task.h" |
19 #include "chrome/browser/task_management/sampling/task_group_sampler.h" | 19 #include "chrome/browser/task_management/sampling/task_group_sampler.h" |
20 #include "chrome/browser/task_management/task_manager_observer.h" | 20 #include "chrome/browser/task_management/task_manager_observer.h" |
21 #include "content/public/common/gpu_memory_stats.h" | 21 |
| 22 namespace gpu { |
| 23 struct VideoMemoryUsageStats; |
| 24 } |
22 | 25 |
23 namespace task_management { | 26 namespace task_management { |
24 | 27 |
25 // Defines a group of tasks tracked by the task manager which belong to the same | 28 // Defines a group of tasks tracked by the task manager which belong to the same |
26 // process. This class lives on the UI thread. | 29 // process. This class lives on the UI thread. |
27 class TaskGroup { | 30 class TaskGroup { |
28 public: | 31 public: |
29 TaskGroup( | 32 TaskGroup( |
30 base::ProcessHandle proc_handle, | 33 base::ProcessHandle proc_handle, |
31 base::ProcessId proc_id, | 34 base::ProcessId proc_id, |
32 const scoped_refptr<base::SequencedTaskRunner>& blocking_pool_runner); | 35 const scoped_refptr<base::SequencedTaskRunner>& blocking_pool_runner); |
33 ~TaskGroup(); | 36 ~TaskGroup(); |
34 | 37 |
35 // Adds and removes the given |task| to this group. |task| must be running on | 38 // Adds and removes the given |task| to this group. |task| must be running on |
36 // the same process represented by this group. | 39 // the same process represented by this group. |
37 void AddTask(Task* task); | 40 void AddTask(Task* task); |
38 void RemoveTask(Task* task); | 41 void RemoveTask(Task* task); |
39 | 42 |
40 void Refresh(const content::GPUVideoMemoryUsageStats& gpu_memory_stats, | 43 void Refresh(const gpu::VideoMemoryUsageStats& gpu_memory_stats, |
41 base::TimeDelta update_interval, | 44 base::TimeDelta update_interval, |
42 int64_t refresh_flags); | 45 int64_t refresh_flags); |
43 | 46 |
44 // Appends the sorted IDs of the tasks that belong to this group to | 47 // Appends the sorted IDs of the tasks that belong to this group to |
45 // |out_list|. | 48 // |out_list|. |
46 void AppendSortedTaskIds(TaskIdList* out_list) const; | 49 void AppendSortedTaskIds(TaskIdList* out_list) const; |
47 | 50 |
48 Task* GetTaskById(TaskId task_id) const; | 51 Task* GetTaskById(TaskId task_id) const; |
49 | 52 |
50 const base::ProcessHandle& process_handle() const { return process_handle_; } | 53 const base::ProcessHandle& process_handle() const { return process_handle_; } |
(...skipping 24 matching lines...) Expand all Loading... |
75 int nacl_debug_stub_port() const { return nacl_debug_stub_port_; } | 78 int nacl_debug_stub_port() const { return nacl_debug_stub_port_; } |
76 #endif // !defined(DISABLE_NACL) | 79 #endif // !defined(DISABLE_NACL) |
77 | 80 |
78 #if defined(OS_LINUX) | 81 #if defined(OS_LINUX) |
79 int open_fd_count() const { return open_fd_count_; } | 82 int open_fd_count() const { return open_fd_count_; } |
80 #endif // defined(OS_LINUX) | 83 #endif // defined(OS_LINUX) |
81 | 84 |
82 int idle_wakeups_per_second() const { return idle_wakeups_per_second_; } | 85 int idle_wakeups_per_second() const { return idle_wakeups_per_second_; } |
83 | 86 |
84 private: | 87 private: |
85 void RefreshGpuMemory( | 88 void RefreshGpuMemory(const gpu::VideoMemoryUsageStats& gpu_memory_stats); |
86 const content::GPUVideoMemoryUsageStats& gpu_memory_stats); | |
87 | 89 |
88 void RefreshWindowsHandles(); | 90 void RefreshWindowsHandles(); |
89 | 91 |
90 // |child_process_unique_id| see Task::GetChildProcessUniqueID(). | 92 // |child_process_unique_id| see Task::GetChildProcessUniqueID(). |
91 void RefreshNaClDebugStubPort(int child_process_unique_id); | 93 void RefreshNaClDebugStubPort(int child_process_unique_id); |
92 | 94 |
93 void OnCpuRefreshDone(double cpu_usage); | 95 void OnCpuRefreshDone(double cpu_usage); |
94 | 96 |
95 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage); | 97 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage); |
96 | 98 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // destroyed. | 143 // destroyed. |
142 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; | 144 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; |
143 | 145 |
144 DISALLOW_COPY_AND_ASSIGN(TaskGroup); | 146 DISALLOW_COPY_AND_ASSIGN(TaskGroup); |
145 }; | 147 }; |
146 | 148 |
147 } // namespace task_management | 149 } // namespace task_management |
148 | 150 |
149 | 151 |
150 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ | 152 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ |
OLD | NEW |