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

Unified Diff: chrome/browser/chromeos/power/power_data_collector.cc

Issue 149973002: [chromeos/about:power] Collect cpuidle and cpufreq stats (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: read sysfs on blocking pool via a non-member function Created 6 years, 9 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: chrome/browser/chromeos/power/power_data_collector.cc
diff --git a/chrome/browser/chromeos/power/power_data_collector.cc b/chrome/browser/chromeos/power/power_data_collector.cc
index b997bb03a9393c7ab51c4f0c4b6a7d007742e9bc..a6ffe8f635264b78445cd76ae65cbb813d00094b 100644
--- a/chrome/browser/chromeos/power/power_data_collector.cc
+++ b/chrome/browser/chromeos/power/power_data_collector.cc
@@ -25,7 +25,13 @@ void PowerDataCollector::Initialize() {
// DBusThreadManager is initialized.
CHECK(DBusThreadManager::Get());
CHECK(g_power_data_collector == NULL);
- g_power_data_collector = new PowerDataCollector();
+ g_power_data_collector = new PowerDataCollector(true);
+}
+
+void PowerDataCollector::InitializeForTesting() {
+ CHECK(DBusThreadManager::Get());
+ CHECK(g_power_data_collector == NULL);
+ g_power_data_collector = new PowerDataCollector(false);
}
// static
@@ -60,8 +66,10 @@ void PowerDataCollector::SystemResumed(const base::TimeDelta& sleep_duration) {
AddSample(&system_resumed_data_, sample);
}
-PowerDataCollector::PowerDataCollector() {
+PowerDataCollector::PowerDataCollector(const bool start_cpu_data_collector) {
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
+ if (start_cpu_data_collector)
+ cpu_data_collector_.Start();
}
PowerDataCollector::~PowerDataCollector() {
« no previous file with comments | « chrome/browser/chromeos/power/power_data_collector.h ('k') | chrome/browser/chromeos/power/power_data_collector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698