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

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

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

Powered by Google App Engine
This is Rietveld 408576698