| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/metrics/file_metrics_provider.h" | 5 #include "components/metrics/file_metrics_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // will continue to be used by the caller after that method returns. Once | 484 // will continue to be used by the caller after that method returns. Once |
| 485 // here, though, all actions to be done on the data have been completed. | 485 // here, though, all actions to be done on the data have been completed. |
| 486 for (const std::unique_ptr<SourceInfo>& source : sources_for_previous_run_) | 486 for (const std::unique_ptr<SourceInfo>& source : sources_for_previous_run_) |
| 487 DeleteFileAsync(source->path); | 487 DeleteFileAsync(source->path); |
| 488 sources_for_previous_run_.clear(); | 488 sources_for_previous_run_.clear(); |
| 489 } | 489 } |
| 490 | 490 |
| 491 bool FileMetricsProvider::HasInitialStabilityMetrics() { | 491 bool FileMetricsProvider::HasInitialStabilityMetrics() { |
| 492 DCHECK(thread_checker_.CalledOnValidThread()); | 492 DCHECK(thread_checker_.CalledOnValidThread()); |
| 493 | 493 |
| 494 // Check if there is an experiment that disables stability metrics. | |
| 495 std::string unreported = variations::GetVariationParamValueByFeature( | |
| 496 base::kPersistentHistogramsFeature, "send_unreported_metrics"); | |
| 497 if (unreported == "no") | |
| 498 sources_for_previous_run_.clear(); | |
| 499 | |
| 500 // Measure the total time spent checking all sources as well as the time | 494 // Measure the total time spent checking all sources as well as the time |
| 501 // per individual file. This method is called during startup and thus blocks | 495 // per individual file. This method is called during startup and thus blocks |
| 502 // the initial showing of the browser window so it's important to know the | 496 // the initial showing of the browser window so it's important to know the |
| 503 // total delay. | 497 // total delay. |
| 504 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.InitialCheckTime.Total"); | 498 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.InitialCheckTime.Total"); |
| 505 | 499 |
| 506 // Check all sources for previous run to see if they need to be read. | 500 // Check all sources for previous run to see if they need to be read. |
| 507 for (auto iter = sources_for_previous_run_.begin(); | 501 for (auto iter = sources_for_previous_run_.begin(); |
| 508 iter != sources_for_previous_run_.end();) { | 502 iter != sources_for_previous_run_.end();) { |
| 509 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.InitialCheckTime.File"); | 503 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.InitialCheckTime.File"); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 // important to know how much total "jank" may be introduced. | 564 // important to know how much total "jank" may be introduced. |
| 571 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total"); | 565 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total"); |
| 572 | 566 |
| 573 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) { | 567 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) { |
| 574 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File"); | 568 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File"); |
| 575 MergeHistogramDeltasFromSource(source.get()); | 569 MergeHistogramDeltasFromSource(source.get()); |
| 576 } | 570 } |
| 577 } | 571 } |
| 578 | 572 |
| 579 } // namespace metrics | 573 } // namespace metrics |
| OLD | NEW |