OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_POWER_PROCESS_POWER_COLLECTOR_H_ | 5 #ifndef CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ |
6 #define CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ | 6 #define CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // information from SynchronizeProcesses() given a total amount | 128 // information from SynchronizeProcesses() given a total amount |
129 // of CPU used in this cycle, |total_cpu_percent|. | 129 // of CPU used in this cycle, |total_cpu_percent|. |
130 void RecordCpuUsageByOrigin(double total_cpu_percent); | 130 void RecordCpuUsageByOrigin(double total_cpu_percent); |
131 | 131 |
132 // Adds the information from a given RenderProcessHost to the |metrics_map_| | 132 // Adds the information from a given RenderProcessHost to the |metrics_map_| |
133 // for a given origin. Called by SynchronizeProcesses(). | 133 // for a given origin. Called by SynchronizeProcesses(). |
134 void UpdateProcessInMap(const content::RenderProcessHost* render_process, | 134 void UpdateProcessInMap(const content::RenderProcessHost* render_process, |
135 const GURL& origin); | 135 const GURL& origin); |
136 | 136 |
137 ProcessMetricsMap metrics_map_; | 137 ProcessMetricsMap metrics_map_; |
138 base::RepeatingTimer<ProcessPowerCollector> timer_; | 138 base::RepeatingTimer timer_; |
139 | 139 |
140 // Callback to use to get CPU usage if set. | 140 // Callback to use to get CPU usage if set. |
141 CpuUsageCallback cpu_usage_callback_; | 141 CpuUsageCallback cpu_usage_callback_; |
142 | 142 |
143 // The factor to scale the CPU usage by. | 143 // The factor to scale the CPU usage by. |
144 double scale_factor_; | 144 double scale_factor_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(ProcessPowerCollector); | 146 DISALLOW_COPY_AND_ASSIGN(ProcessPowerCollector); |
147 }; | 147 }; |
148 | 148 |
149 #endif // CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ | 149 #endif // CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ |
OLD | NEW |