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

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

Issue 1374283003: Reporting top cpu and memory consumers via rappor on chromeos (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed arbitrary given weights Created 5 years, 1 month 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 <map> 8 #include <map>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
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 bool is_backgrounded() const { return is_backgrounded_; }
57 58
58 #if defined(OS_WIN) 59 #if defined(OS_WIN)
59 int64 gdi_current_handles() const { return gdi_current_handles_; } 60 int64 gdi_current_handles() const { return gdi_current_handles_; }
60 int64 gdi_peak_handles() const { return gdi_peak_handles_; } 61 int64 gdi_peak_handles() const { return gdi_peak_handles_; }
61 int64 user_current_handles() const { return user_current_handles_; } 62 int64 user_current_handles() const { return user_current_handles_; }
62 int64 user_peak_handles() const { return user_peak_handles_; } 63 int64 user_peak_handles() const { return user_peak_handles_; }
63 #endif // defined(OS_WIN) 64 #endif // defined(OS_WIN)
64 65
65 #if !defined(DISABLE_NACL) 66 #if !defined(DISABLE_NACL)
66 int nacl_debug_stub_port() const { return nacl_debug_stub_port_; } 67 int nacl_debug_stub_port() const { return nacl_debug_stub_port_; }
67 #endif // !defined(DISABLE_NACL) 68 #endif // !defined(DISABLE_NACL)
68 69
69 int idle_wakeups_per_second() const { return idle_wakeups_per_second_; } 70 int idle_wakeups_per_second() const { return idle_wakeups_per_second_; }
70 71
71 private: 72 private:
72 void RefreshGpuMemory( 73 void RefreshGpuMemory(
73 const content::GPUVideoMemoryUsageStats& gpu_memory_stats); 74 const content::GPUVideoMemoryUsageStats& gpu_memory_stats);
74 75
75 void RefreshWindowsHandles(); 76 void RefreshWindowsHandles();
76 77
77 // |child_process_unique_id| see Task::GetChildProcessUniqueID(). 78 // |child_process_unique_id| see Task::GetChildProcessUniqueID().
78 void RefreshNaClDebugStubPort(int child_process_unique_id); 79 void RefreshNaClDebugStubPort(int child_process_unique_id);
79 80
80 void OnCpuRefreshDone(double cpu_usage); 81 void OnCpuRefreshDone(double cpu_usage);
81 82
82 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage); 83 void OnMemoryUsageRefreshDone(MemoryUsageStats memory_usage);
83 84
84 void OnIdleWakeupsRefreshDone(int idle_wakeups_per_second); 85 void OnIdleWakeupsRefreshDone(int idle_wakeups_per_second);
85 86
87 void OnProcessPriorityDone(bool is_backgrounded);
88
86 // The process' handle and ID. 89 // The process' handle and ID.
87 base::ProcessHandle process_handle_; 90 base::ProcessHandle process_handle_;
88 base::ProcessId process_id_; 91 base::ProcessId process_id_;
89 92
90 scoped_refptr<TaskGroupSampler> worker_thread_sampler_; 93 scoped_refptr<TaskGroupSampler> worker_thread_sampler_;
91 94
92 // Maps the Tasks by their IDs. 95 // Maps the Tasks by their IDs.
93 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders. 96 // Tasks are not owned by the TaskGroup. They're owned by the TaskProviders.
94 std::map<TaskId, Task*> tasks_; 97 std::map<TaskId, Task*> tasks_;
95 98
96 // The per process resources usages. 99 // The per process resources usages.
97 double cpu_usage_; 100 double cpu_usage_;
98 MemoryUsageStats memory_usage_; 101 MemoryUsageStats memory_usage_;
99 int64 gpu_memory_; 102 int64 gpu_memory_;
100 #if defined(OS_WIN) 103 #if defined(OS_WIN)
101 // Windows GDI and USER Handles. 104 // Windows GDI and USER Handles.
102 int64 gdi_current_handles_; 105 int64 gdi_current_handles_;
103 int64 gdi_peak_handles_; 106 int64 gdi_peak_handles_;
104 int64 user_current_handles_; 107 int64 user_current_handles_;
105 int64 user_peak_handles_; 108 int64 user_peak_handles_;
106 #endif // defined(OS_WIN) 109 #endif // defined(OS_WIN)
107 #if !defined(DISABLE_NACL) 110 #if !defined(DISABLE_NACL)
108 int nacl_debug_stub_port_; 111 int nacl_debug_stub_port_;
109 #endif // !defined(DISABLE_NACL) 112 #endif // !defined(DISABLE_NACL)
110 int idle_wakeups_per_second_; 113 int idle_wakeups_per_second_;
111 bool gpu_memory_has_duplicates_; 114 bool gpu_memory_has_duplicates_;
115 bool is_backgrounded_;
112 116
113 // Always keep this the last member of this class so that it's the first to be 117 // Always keep this the last member of this class so that it's the first to be
114 // destroyed. 118 // destroyed.
115 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_; 119 base::WeakPtrFactory<TaskGroup> weak_ptr_factory_;
116 120
117 DISALLOW_COPY_AND_ASSIGN(TaskGroup); 121 DISALLOW_COPY_AND_ASSIGN(TaskGroup);
118 }; 122 };
119 123
120 } // namespace task_management 124 } // namespace task_management
121 125
122 126
123 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_ 127 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698