Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ | |
| 6 #define CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/time/time.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 struct PowerEvent { | |
| 16 enum Type { | |
| 17 // Total power of SoC. including CPU, GT and others on the chip, | |
| 18 // modules which aren't part of the SoC such as the screen are not included. | |
| 19 SOC_PACKAGE, | |
| 20 | |
| 21 // Whole device power. | |
| 22 DEVICE, | |
| 23 | |
| 24 // Keep this at the end. | |
| 25 ID_COUNT | |
| 26 }; | |
| 27 | |
| 28 Type type; | |
| 29 | |
| 30 base::TimeTicks time; // Time that power data was read. | |
|
jeremy
2014/02/18 11:35:33
2 spaces before //
Pan
2014/02/18 12:58:39
Done.
| |
| 31 | |
| 32 // Power value between last event and this one, in watts. | |
| 33 // E.g, event1 {t1, v1}; event2 {t2, v2}; event3 {t3, v3}. | |
| 34 // Suppose event1 is the first event the observer received, then event2, | |
| 35 // event3. Then v2 is the average power from t1 to t2, v3 is the average | |
| 36 // power from t2 to t3. v1 should be ignored since event1 only means the | |
| 37 // start point of power profiling. | |
| 38 double value; | |
| 39 }; | |
| 40 | |
| 41 extern const char* kPowerTypeNames[]; | |
| 42 | |
| 43 typedef std::vector<PowerEvent> PowerEventVector; | |
| 44 | |
| 45 // A class used to get power usage. | |
| 46 class PowerDataProvider { | |
| 47 public: | |
| 48 PowerDataProvider() {} | |
| 49 virtual ~PowerDataProvider() {} | |
| 50 | |
| 51 // Returns a vector of power events, one per type, for the type it supports. | |
|
jeremy
2014/02/18 11:35:33
for the types it supports?
Pan
2014/02/18 12:58:39
Done.
| |
| 52 virtual PowerEventVector GetData() = 0; | |
| 53 | |
| 54 private: | |
| 55 DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); | |
| 56 }; | |
| 57 | |
| 58 } // namespace content | |
| 59 | |
| 60 #endif // CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ | |
| OLD | NEW |