Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: chrome/browser/task_management/sampling/task_group.h

Issue 2028753002: Make Task Manager sort more meaningful (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittest Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 27 matching lines...) Expand all
38 38
39 // Adds and removes the given |task| to this group. |task| must be running on 39 // Adds and removes the given |task| to this group. |task| must be running on
40 // the same process represented by this group. 40 // the same process represented by this group.
41 void AddTask(Task* task); 41 void AddTask(Task* task);
42 void RemoveTask(Task* task); 42 void RemoveTask(Task* task);
43 43
44 void Refresh(const gpu::VideoMemoryUsageStats& gpu_memory_stats, 44 void Refresh(const gpu::VideoMemoryUsageStats& gpu_memory_stats,
45 base::TimeDelta update_interval, 45 base::TimeDelta update_interval,
46 int64_t refresh_flags); 46 int64_t refresh_flags);
47 47
48 // Appends the sorted IDs of the tasks that belong to this group to
49 // |out_list|.
50 void AppendSortedTaskIds(TaskIdList* out_list) const;
51
52 Task* GetTaskById(TaskId task_id) const; 48 Task* GetTaskById(TaskId task_id) const;
53 49
54 // This is to be called after the task manager had informed its observers with 50 // This is to be called after the task manager had informed its observers with
55 // OnTasksRefreshedWithBackgroundCalculations() to begin another cycle for 51 // OnTasksRefreshedWithBackgroundCalculations() to begin another cycle for
56 // this notification type. 52 // this notification type.
57 void ClearCurrentBackgroundCalculationsFlags(); 53 void ClearCurrentBackgroundCalculationsFlags();
58 54
59 // True if all enabled background operations calculating resource usage of the 55 // True if all enabled background operations calculating resource usage of the
60 // process represented by this TaskGroup have completed. 56 // process represented by this TaskGroup have completed.
61 bool AreBackgroundCalculationsDone() const; 57 bool AreBackgroundCalculationsDone() const;
62 58
63 const base::ProcessHandle& process_handle() const { return process_handle_; } 59 const base::ProcessHandle& process_handle() const { return process_handle_; }
64 const base::ProcessId& process_id() const { return process_id_; } 60 const base::ProcessId& process_id() const { return process_id_; }
65 61
66 size_t num_tasks() const { return tasks_.size(); } 62 const std::vector<Task*>& tasks() const { return tasks_; }
67 bool empty() const { return tasks_.empty(); } 63 size_t num_tasks() const { return tasks().size(); }
64 bool empty() const { return tasks().empty(); }
68 65
69 double cpu_usage() const { return cpu_usage_; } 66 double cpu_usage() const { return cpu_usage_; }
70 int64_t private_bytes() const { return memory_usage_.private_bytes; } 67 int64_t private_bytes() const { return memory_usage_.private_bytes; }
71 int64_t shared_bytes() const { return memory_usage_.shared_bytes; } 68 int64_t shared_bytes() const { return memory_usage_.shared_bytes; }
72 int64_t physical_bytes() const { return memory_usage_.physical_bytes; } 69 int64_t physical_bytes() const { return memory_usage_.physical_bytes; }
73 #if defined(OS_CHROMEOS) 70 #if defined(OS_CHROMEOS)
74 int64_t swapped_bytes() const { return memory_usage_.swapped_bytes; } 71 int64_t swapped_bytes() const { return memory_usage_.swapped_bytes; }
75 #endif 72 #endif
76 int64_t gpu_memory() const { return gpu_memory_; } 73 int64_t gpu_memory() const { return gpu_memory_; }
77 bool gpu_memory_has_duplicates() const { return gpu_memory_has_duplicates_; } 74 bool gpu_memory_has_duplicates() const { return gpu_memory_has_duplicates_; }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // The process' handle and ID. 119 // The process' handle and ID.
123 base::ProcessHandle process_handle_; 120 base::ProcessHandle process_handle_;
124 base::ProcessId process_id_; 121 base::ProcessId process_id_;
125 122
126 // This is a callback into the TaskManagerImpl to inform it that the 123 // This is a callback into the TaskManagerImpl to inform it that the
127 // background calculations for this TaskGroup has finished. 124 // background calculations for this TaskGroup has finished.
128 const base::Closure on_background_calculations_done_; 125 const base::Closure on_background_calculations_done_;
129 126
130 scoped_refptr<TaskGroupSampler> worker_thread_sampler_; 127 scoped_refptr<TaskGroupSampler> worker_thread_sampler_;
131 128
132 // Maps the Tasks by their IDs. 129 // Lists the Tasks in this TaskGroup.
133 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders. 130 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders.
134 std::map<TaskId, Task*> tasks_; 131 std::vector<Task*> tasks_;
135 132
136 // Flags will be used to determine when the background calculations has 133 // Flags will be used to determine when the background calculations has
137 // completed for the enabled refresh types for this TaskGroup. 134 // completed for the enabled refresh types for this TaskGroup.
138 int64_t expected_on_bg_done_flags_; 135 int64_t expected_on_bg_done_flags_;
139 int64_t current_on_bg_done_flags_; 136 int64_t current_on_bg_done_flags_;
140 137
141 // The per process resources usages. 138 // The per process resources usages.
142 double cpu_usage_; 139 double cpu_usage_;
143 MemoryUsageStats memory_usage_; 140 MemoryUsageStats memory_usage_;
144 int64_t gpu_memory_; 141 int64_t gpu_memory_;
(...skipping 22 matching lines...) Expand all
167 // destroyed. 164 // destroyed.
168 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; 165 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_;
169 166
170 DISALLOW_COPY_AND_ASSIGN(TaskGroup); 167 DISALLOW_COPY_AND_ASSIGN(TaskGroup);
171 }; 168 };
172 169
173 } // namespace task_management 170 } // namespace task_management
174 171
175 172
176 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ 173 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698