Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1160)

Unified Diff: content/browser/power_profiler/power_data_provider.h

Issue 140583003: Chrome power profiler service (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move complex destructor impl to .cc Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..987dfe056e8dcbee5af1b09a533a314ee2f45a11
--- /dev/null
+++ b/content/browser/power_profiler/power_data_provider.h
@@ -0,0 +1,60 @@
+// 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 which aren't part of the SoC such as the screen are not included.
+ SOC_PACKAGE,
+
+ // Whole device power.
+ DEVICE,
+
+ // Count the number of known PowerEvent. Keep this at the end.
jeremy 2014/02/17 06:31:13 Just the second sentence is enough, the first par
Pan 2014/02/17 07:53:37 Done.
+ ID_COUNT
+ };
+
+ Type type;
+
+ base::TimeTicks time; // Time that power data was read.
+
+ // Power value between last event to this one, in watt.
jeremy 2014/02/17 06:31:13 to -> and watt -> watts
Pan 2014/02/17 07:53:37 Done.
+ // E.g, event1 {t1, v1}; event2 {t2, v2}; event3 {t3, v3}.
+ // Suppose event1 is the first event the observer received, then event2,
+ // event3. Then v2 is the average power from t1 to t2, v3 is the average
+ // power from t2 to 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.
+class PowerDataProvider {
+ public:
+ PowerDataProvider() {}
+ virtual ~PowerDataProvider() {}
+
+ // Returns a vector of power events, one per type, for the type it supports.
+ virtual PowerEventVector GetData() = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PowerDataProvider);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_POWER_PROFILER_POWER_DATA_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698