Chromium Code Reviews| Index: chrome/browser/chromeos/power/cpu_data_collector.h |
| diff --git a/chrome/browser/chromeos/power/cpu_data_collector.h b/chrome/browser/chromeos/power/cpu_data_collector.h |
| index c9b4bcb849d6b87f9aabc9dbfa2ae48f85aeddae..184cd8bf1ff188c4529ee84a9d37c05568131441 100644 |
| --- a/chrome/browser/chromeos/power/cpu_data_collector.h |
| +++ b/chrome/browser/chromeos/power/cpu_data_collector.h |
| @@ -71,6 +71,64 @@ class CpuDataCollector { |
| // CPU state occupancy samples. |
| void Start(); |
| + // Samples the CPU idle state information from sysfs. |cpu_count| is the |
| + // number of possible CPUs on the system. Sample at index i in |idle_samples| |
| + // corresponds to the idle state information of the i-th CPU. |
| + static void SampleCpuIdleData( |
|
Daniel Erat
2017/05/02 23:41:10
only the methods that you're actually calling from
weidongg
2017/05/03 21:32:31
Done.
|
| + int cpu_count, |
| + std::vector<std::string>* cpu_idle_state_names, |
| + std::vector<CpuDataCollector::StateOccupancySample>* idle_samples); |
| + |
| + // Read CPU frequency data of a specific CPU from the file in |path| and fill |
| + // |cpu_freq_state_names| and |freq_sample| with the data. |
| + // Sample file looks like: |
| + // 126000 223344 |
| + // 216000 93495 |
| + // ... |
| + // 1800000 321907 |
| + static bool ReadCpuFreqTimeInState( |
| + const std::string& path, |
| + std::vector<std::string>* cpu_freq_state_names, |
| + CpuDataCollector::StateOccupancySample* freq_sample); |
| + |
| + // Read CPU frequency data of all CPUs from the file in |path| and fill |
| + // |cpu_freq_state_names| and |freq_samples| with the data. |cpu_count| is the |
| + // number of possible CPUs on the system. Note that |freq_samples| is not |
| + // empty and sample at index i in |freq_samples| corresponds to the freq state |
| + // information of the i-th CPU. |cpu_online| of each sample must be set before |
| + // calling this function. |
| + // Sample file looks like: |
| + // freq cpu0 cpu1 |
| + // 126000 223344 223311 |
| + // 216000 93495 93450 |
| + // ... |
| + // 1800000 321907 331897 |
| + static bool ReadCpuFreqAllTimeInState( |
| + int cpu_count, |
| + const std::string& path, |
| + std::vector<std::string>* cpu_freq_state_names, |
| + std::vector<CpuDataCollector::StateOccupancySample>* freq_samples); |
| + |
| + // Samples the CPU freq state information from sysfs. |cpu_count| is the |
| + // number of possible CPUs on the system. Sample at index i in |freq_samples| |
| + // corresponds to the freq state information of the i-th CPU. |
| + static void SampleCpuFreqData( |
|
Daniel Erat
2017/05/02 23:41:10
see above
weidongg
2017/05/03 21:32:31
Done.
|
| + int cpu_count, |
| + std::vector<std::string>* cpu_freq_state_names, |
| + std::vector<CpuDataCollector::StateOccupancySample>* freq_samples); |
| + |
| + // Samples CPU idle and CPU freq data from sysfs. This function should run on |
| + // the blocking pool as reading from sysfs is a blocking task. Elements at |
| + // index i in |idle_samples| and |freq_samples| correspond to the idle and |
| + // freq samples of CPU i. This also function reads the number of CPUs from |
| + // sysfs if *|cpu_count| < 0. |
| + static void SampleCpuStateAsync( |
|
Daniel Erat
2017/05/02 23:41:10
see above
weidongg
2017/05/03 21:32:31
Done.
|
| + int* cpu_count, |
| + std::vector<std::string>* cpu_idle_state_names, |
| + std::vector<CpuDataCollector::StateOccupancySample>* idle_samples, |
| + std::vector<std::string>* cpu_freq_state_names, |
| + std::vector<CpuDataCollector::StateOccupancySample>* freq_samples); |
| + |
| private: |
| // Posts callbacks to the blocking pool which collect CPU state occupancy |
| // samples from the sysfs. |