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 "base/basictypes.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/time/time.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 // PowerEvent here is the total power of SoC, including CPU, GPU and others | |
| 15 // on the chip, modules out of SoC such as screen is not included. | |
| 16 struct PowerEvent { | |
| 17 base::TimeTicks time; // Time that power data was read. | |
| 18 | |
| 19 // Power value between last event to this one, in watt. | |
| 20 // E.g, event1 {t1, v1}; event2 {t2, v2}; event3 {t3, v3}. | |
| 21 // Suppose event1 is the first event observer received, then event2, event3. | |
| 22 // Then v2 is average power from t1 to t2, v3 is the average power from t2 to | |
| 23 // t3. v1 should be ignored since event1 only means the start point of power | |
| 24 // profiling. | |
| 25 double value; | |
|
qsr
2014/02/10 14:02:49
See jeremy@ message, we probably want an enum ther
Pan
2014/02/11 02:03:23
done.
IMHO, we should provide per data here, and a
| |
| 26 }; | |
| 27 | |
| 28 // a class used to GET power usage. | |
| 29 class PowerDataProvider { | |
| 30 public: | |
| 31 PowerDataProvider() {} | |
| 32 virtual ~PowerDataProvider() {} | |
| 33 | |
| 34 // Return true when success, it fills a single PowerEvent, which should be | |
| 35 // allocated by its caller. | |
| 36 virtual bool GetData(PowerEvent*) = 0; | |
| 37 | |
| 38 private: | |
| 39 DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); | |
| 40 }; | |
| 41 | |
| 42 class PowerDataProviderFactory { | |
| 43 public: | |
| 44 // Create a provider, and transfer the ownership to PowerProfilerService. | |
| 45 static scoped_ptr<PowerDataProvider> Create(); | |
| 46 | |
| 47 private: | |
| 48 PowerDataProviderFactory() {} | |
| 49 DISALLOW_COPY_AND_ASSIGN(PowerDataProviderFactory); | |
| 50 }; | |
| 51 | |
| 52 } // namespace content | |
| 53 | |
| 54 #endif // CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ | |
| OLD | NEW |