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. |
| 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 typedef std::vector<PowerEvent> PowerEventVector; |
| 40 |
| 41 // a class used to GET power usage. |
| 42 class PowerDataProvider { |
| 43 public: |
| 44 PowerDataProvider() {} |
| 45 virtual ~PowerDataProvider() {} |
| 46 |
| 47 // Return a vector of power events, one per type, |
| 48 // due to the type it supports. |
| 49 virtual PowerEventVector GetData() = 0; |
| 50 |
| 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); |
| 53 }; |
| 54 |
| 55 class PowerDataProviderFactory { |
| 56 public: |
| 57 // Create a provider, and transfer the ownership to PowerProfilerService. |
| 58 static scoped_ptr<PowerDataProvider> Create(); |
| 59 |
| 60 private: |
| 61 PowerDataProviderFactory() {} |
| 62 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory); |
| 63 }; |
| 64 |
| 65 } // namespace content |
| 66 |
| 67 #endif // CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ |
OLD | NEW |