Chromium Code Reviews| Index: content/browser/power_profiler/power_data_provider.h |
| diff --git a/content/browser/power_profiler/power_data_provider.h b/content/browser/power_profiler/power_data_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..43ef0dcc4bc2a2426e5e3504d4abe07c64295773 |
| --- /dev/null |
| +++ b/content/browser/power_profiler/power_data_provider.h |
| @@ -0,0 +1,61 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ |
| +#define CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/time/time.h" |
| + |
| +namespace content { |
| + |
| +struct PowerEvent { |
| + enum Type { |
| + // Total power of SoC. including CPU, GT and others on the chip, |
| + // modules out of SoC such as screen is not included. |
|
jeremy
2014/02/16 14:09:19
nit: modules which aren't part of the SoC such as
Pan
2014/02/17 03:17:15
Done.
|
| + SOC_PACKAGE, |
| + |
| + // Whole device power. |
| + DEVICE, |
| + |
| + // Count the number of known PowerEvent. |
|
jeremy
2014/02/16 14:09:19
nit: // Keep this at the end.
Pan
2014/02/17 03:17:15
Done.
|
| + ID_COUNT |
| + }; |
| + |
| + Type type; |
| + |
| + base::TimeTicks time; // Time that power data was read. |
| + |
| + // Power value between last event to this one, in watt. |
| + // E.g, event1 {t1, v1}; event2 {t2, v2}; event3 {t3, v3}. |
| + // Suppose event1 is the first event observer received, then event2, event3. |
|
jeremy
2014/02/16 14:09:19
nit: the observer
Pan
2014/02/17 03:17:15
Done.
|
| + // Then v2 is average power from t1 to t2, v3 is the average power from t2 to |
|
jeremy
2014/02/16 14:09:19
nit: the average
Pan
2014/02/17 03:17:15
Done.
|
| + // t3. v1 should be ignored since event1 only means the start point of power |
| + // profiling. |
| + double value; |
| +}; |
| + |
| +extern const char* kPowerTypeNames[]; |
| + |
| +typedef std::vector<PowerEvent> PowerEventVector; |
| + |
| +// a class used to GET power usage. |
|
jeremy
2014/02/16 14:09:19
nit: s/a/A/
nit: lowercase get ?
Pan
2014/02/17 03:17:15
Done.
|
| +class PowerDataProvider { |
| + public: |
| + PowerDataProvider() {} |
| + virtual ~PowerDataProvider() {} |
| + |
| + // Return a vector of power events, one per type, |
| + // due to the type it supports. |
|
jeremy
2014/02/16 14:09:19
nit: 'Returns' , s/due/for/
Pan
2014/02/17 03:17:15
Done.
|
| + virtual PowerEventVector GetData() = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(PowerDataProvider); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_ |