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/memory/scoped_ptr.h" | |
| 12 #include "base/time/time.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 struct PowerEvent { | |
| 17 enum Type { | |
| 18 // Total power of SoC. including CPU, GT and others on the chip, | |
| 19 // modules out of SoC such as screen is not included. | |
|
qsr
2014/02/13 16:40:13
Can you add a type of the whole device consumption
Pan
2014/02/14 07:17:02
Done.
| |
| 20 SOC_PACKAGE, | |
| 21 | |
| 22 // Count the number of known PowerEvent. | |
| 23 ID_COUNT | |
| 24 }; | |
| 25 | |
| 26 Type type; | |
| 27 | |
| 28 base::TimeTicks time; // Time that power data was read. | |
| 29 | |
| 30 // Power value between last event to this one, in watt. | |
| 31 // E.g, event1 {t1, v1}; event2 {t2, v2}; event3 {t3, v3}. | |
| 32 // Suppose event1 is the first event observer received, then event2, event3. | |
| 33 // Then v2 is average power from t1 to t2, v3 is the average power from t2 to | |
| 34 // t3. v1 should be ignored since event1 only means the start point of power | |
| 35 // profiling. | |
| 36 double value; | |
| 37 }; | |
| 38 | |
| 39 extern const char* kPowerTypeNames[]; | |
| 40 | |
| 41 typedef std::vector<PowerEvent> PowerEventVector; | |
| 42 | |
| 43 // a class used to GET power usage. | |
| 44 class PowerDataProvider { | |
| 45 public: | |
| 46 PowerDataProvider() {} | |
| 47 virtual ~PowerDataProvider() {} | |
| 48 | |
| 49 // Return a vector of power events, one per type, | |
| 50 // due to the type it supports. | |
| 51 virtual PowerEventVector GetData() = 0; | |
| 52 | |
| 53 private: | |
| 54 DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); | |
| 55 }; | |
| 56 | |
| 57 class PowerDataProviderFactory { | |
| 58 public: | |
| 59 // Create a provider, and transfer the ownership to PowerProfilerService. | |
| 60 static scoped_ptr<PowerDataProvider> Create(); | |
| 61 | |
| 62 private: | |
| 63 PowerDataProviderFactory() {} | |
| 64 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory); | |
| 65 }; | |
| 66 | |
| 67 } // namespace content | |
| 68 | |
| 69 #endif // CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ | |
| OLD | NEW |