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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 void set_cpu_usage_callback_for_testing(const CpuUsageCallback& callback) { | 90 void set_cpu_usage_callback_for_testing(const CpuUsageCallback& callback) { |
91 cpu_usage_callback_ = callback; | 91 cpu_usage_callback_ = callback; |
92 } | 92 } |
93 | 93 |
94 ProcessMetricsMap* metrics_map_for_testing() { return &metrics_map_; } | 94 ProcessMetricsMap* metrics_map_for_testing() { return &metrics_map_; } |
95 | 95 |
96 #if defined(OS_CHROMEOS) | 96 #if defined(OS_CHROMEOS) |
97 // PowerManagerClient::Observer implementation: | 97 // PowerManagerClient::Observer implementation: |
98 virtual void PowerChanged( | 98 virtual void PowerChanged( |
99 const power_manager::PowerSupplyProperties& prop) OVERRIDE; | 99 const power_manager::PowerSupplyProperties& prop) override; |
100 #endif | 100 #endif |
101 | 101 |
102 // Begin periodically updating the power consumption numbers by profile. | 102 // Begin periodically updating the power consumption numbers by profile. |
103 void Initialize(); | 103 void Initialize(); |
104 | 104 |
105 // Calls UpdatePowerConsumption() and returns the total CPU percent. | 105 // Calls UpdatePowerConsumption() and returns the total CPU percent. |
106 double UpdatePowerConsumptionForTesting(); | 106 double UpdatePowerConsumptionForTesting(); |
107 | 107 |
108 private: | 108 private: |
109 // Starts the timer for updating the power consumption. | 109 // Starts the timer for updating the power consumption. |
(...skipping 27 matching lines...) Expand all Loading... |
137 // Callback to use to get CPU usage if set. | 137 // Callback to use to get CPU usage if set. |
138 CpuUsageCallback cpu_usage_callback_; | 138 CpuUsageCallback cpu_usage_callback_; |
139 | 139 |
140 // The factor to scale the CPU usage by. | 140 // The factor to scale the CPU usage by. |
141 double scale_factor_; | 141 double scale_factor_; |
142 | 142 |
143 DISALLOW_COPY_AND_ASSIGN(ProcessPowerCollector); | 143 DISALLOW_COPY_AND_ASSIGN(ProcessPowerCollector); |
144 }; | 144 }; |
145 | 145 |
146 #endif // CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ | 146 #endif // CHROME_BROWSER_POWER_PROCESS_POWER_COLLECTOR_H_ |
OLD | NEW |