| OLD | NEW |
| 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 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 base::Owned(cpu_freq_state_names), | 375 base::Owned(cpu_freq_state_names), |
| 376 base::Owned(freq_samples))); | 376 base::Owned(freq_samples))); |
| 377 } | 377 } |
| 378 | 378 |
| 379 void CpuDataCollector::SaveCpuStateSamplesOnUIThread( | 379 void CpuDataCollector::SaveCpuStateSamplesOnUIThread( |
| 380 const int* cpu_count, | 380 const int* cpu_count, |
| 381 const std::vector<std::string>* cpu_idle_state_names, | 381 const std::vector<std::string>* cpu_idle_state_names, |
| 382 const std::vector<CpuDataCollector::StateOccupancySample>* idle_samples, | 382 const std::vector<CpuDataCollector::StateOccupancySample>* idle_samples, |
| 383 const std::vector<std::string>* cpu_freq_state_names, | 383 const std::vector<std::string>* cpu_freq_state_names, |
| 384 const std::vector<CpuDataCollector::StateOccupancySample>* freq_samples) { | 384 const std::vector<CpuDataCollector::StateOccupancySample>* freq_samples) { |
| 385 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 385 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 386 | 386 |
| 387 cpu_count_ = *cpu_count; | 387 cpu_count_ = *cpu_count; |
| 388 | 388 |
| 389 // |idle_samples| or |freq_samples| could be empty sometimes (for example, if | 389 // |idle_samples| or |freq_samples| could be empty sometimes (for example, if |
| 390 // sampling was interrupted due to system suspension). Iff they are not empty, | 390 // sampling was interrupted due to system suspension). Iff they are not empty, |
| 391 // they will have one sample each for each of the CPUs. | 391 // they will have one sample each for each of the CPUs. |
| 392 | 392 |
| 393 if (!idle_samples->empty()) { | 393 if (!idle_samples->empty()) { |
| 394 // When committing the first sample, resize the data vector to the number of | 394 // When committing the first sample, resize the data vector to the number of |
| 395 // CPUs on the system. This number should be the same as the number of | 395 // CPUs on the system. This number should be the same as the number of |
| (...skipping 25 matching lines...) Expand all Loading... |
| 421 } | 421 } |
| 422 | 422 |
| 423 CpuDataCollector::StateOccupancySample::StateOccupancySample() | 423 CpuDataCollector::StateOccupancySample::StateOccupancySample() |
| 424 : cpu_online(false) { | 424 : cpu_online(false) { |
| 425 } | 425 } |
| 426 | 426 |
| 427 CpuDataCollector::StateOccupancySample::~StateOccupancySample() { | 427 CpuDataCollector::StateOccupancySample::~StateOccupancySample() { |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace chromeos | 430 } // namespace chromeos |
| OLD | NEW |