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

Side by Side Diff: chrome/browser/chromeos/power/cpu_data_collector.h

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_POWER_CPU_DATA_COLLECTOR_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POWER_CPU_DATA_COLLECTOR_H_
6 #define CHROME_BROWSER_CHROMEOS_POWER_CPU_DATA_COLLECTOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_POWER_CPU_DATA_COLLECTOR_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // SampleCpuStateOnBlockingPool to |cpu_idle_state_data_| and 77 // SampleCpuStateOnBlockingPool to |cpu_idle_state_data_| and
78 // |cpu_freq_state_data_|. Since UI is the consumer of CPU idle and freq data, 78 // |cpu_freq_state_data_|. Since UI is the consumer of CPU idle and freq data,
79 // this function should run on the UI thread. 79 // this function should run on the UI thread.
80 void SaveCpuStateSamplesOnUIThread( 80 void SaveCpuStateSamplesOnUIThread(
81 const int* cpu_count, 81 const int* cpu_count,
82 const std::vector<std::string>* cpu_idle_state_names, 82 const std::vector<std::string>* cpu_idle_state_names,
83 const std::vector<StateOccupancySample>* idle_samples, 83 const std::vector<StateOccupancySample>* idle_samples,
84 const std::vector<std::string>* cpu_freq_state_names, 84 const std::vector<std::string>* cpu_freq_state_names,
85 const std::vector<StateOccupancySample>* freq_samples); 85 const std::vector<StateOccupancySample>* freq_samples);
86 86
87 base::RepeatingTimer<CpuDataCollector> timer_; 87 base::RepeatingTimer timer_;
88 88
89 // Names of the idle states. 89 // Names of the idle states.
90 std::vector<std::string> cpu_idle_state_names_; 90 std::vector<std::string> cpu_idle_state_names_;
91 91
92 // The deque at index <i> in the vector corresponds to the idle state 92 // The deque at index <i> in the vector corresponds to the idle state
93 // occupancy data of CPU<i>. 93 // occupancy data of CPU<i>.
94 std::vector<StateOccupancySampleDeque> cpu_idle_state_data_; 94 std::vector<StateOccupancySampleDeque> cpu_idle_state_data_;
95 95
96 // Names of the freq states. 96 // Names of the freq states.
97 std::vector<std::string> cpu_freq_state_names_; 97 std::vector<std::string> cpu_freq_state_names_;
98 98
99 // The deque at index <i> in the vector corresponds to the frequency state 99 // The deque at index <i> in the vector corresponds to the frequency state
100 // occupancy data of CPU<i>. 100 // occupancy data of CPU<i>.
101 std::vector<StateOccupancySampleDeque> cpu_freq_state_data_; 101 std::vector<StateOccupancySampleDeque> cpu_freq_state_data_;
102 102
103 // The number of CPUs on the system. This value is read from the sysfs, and 103 // The number of CPUs on the system. This value is read from the sysfs, and
104 // hence should be read/written to only from the blocking pool. 104 // hence should be read/written to only from the blocking pool.
105 int cpu_count_; 105 int cpu_count_;
106 106
107 base::WeakPtrFactory<CpuDataCollector> weak_ptr_factory_; 107 base::WeakPtrFactory<CpuDataCollector> weak_ptr_factory_;
108 DISALLOW_COPY_AND_ASSIGN(CpuDataCollector); 108 DISALLOW_COPY_AND_ASSIGN(CpuDataCollector);
109 }; 109 };
110 110
111 } // namespace chromeos 111 } // namespace chromeos
112 112
113 #endif // CHROME_BROWSER_CHROMEOS_POWER_CPU_DATA_COLLECTOR_H_ 113 #endif // CHROME_BROWSER_CHROMEOS_POWER_CPU_DATA_COLLECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698