| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 | 539 |
| 540 bool success = false; | 540 bool success = false; |
| 541 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_ATTEMPT); | 541 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_ATTEMPT); |
| 542 if (PersistentSystemProfile::GetSystemProfile( | 542 if (PersistentSystemProfile::GetSystemProfile( |
| 543 *source->allocator->memory_allocator(), system_profile_proto)) { | 543 *source->allocator->memory_allocator(), system_profile_proto)) { |
| 544 RecordHistogramSnapshotsFromSource(snapshot_manager, source); | 544 RecordHistogramSnapshotsFromSource(snapshot_manager, source); |
| 545 success = true; | 545 success = true; |
| 546 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_FOUND); | 546 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_FOUND); |
| 547 } else { | 547 } else { |
| 548 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_DROPPED); | 548 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_DROPPED); |
| 549 |
| 550 // TODO(bcwhite): Remove these once crbug/695880 is resolved. |
| 551 |
| 552 int histogram_count = 0; |
| 553 base::PersistentHistogramAllocator::Iterator histogram_iter( |
| 554 source->allocator.get()); |
| 555 while (histogram_iter.GetNext()) { |
| 556 ++histogram_count; |
| 557 } |
| 558 UMA_HISTOGRAM_COUNTS_10000( |
| 559 "UMA.FileMetricsProvider.EmbeddedProfile.DroppedHistogramCount", |
| 560 histogram_count); |
| 561 |
| 562 base::File::Info info; |
| 563 if (base::GetFileInfo(source->path, &info)) { |
| 564 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 565 "UMA.FileMetricsProvider.EmbeddedProfile.DroppedFileAge", |
| 566 (base::Time::Now() - info.last_modified).InMinutes(), 1, |
| 567 base::TimeDelta::FromDays(30).InMinutes(), 50); |
| 568 } |
| 549 } | 569 } |
| 550 | 570 |
| 551 // Regardless of whether this source was successfully recorded, it is never | 571 // Regardless of whether this source was successfully recorded, it is never |
| 552 // read again. | 572 // read again. |
| 553 source->read_complete = true; | 573 source->read_complete = true; |
| 554 RecordSourceAsRead(source); | 574 RecordSourceAsRead(source); |
| 555 sources_to_check_.splice(sources_to_check_.end(), sources_with_profile_, | 575 sources_to_check_.splice(sources_to_check_.end(), sources_with_profile_, |
| 556 sources_with_profile_.begin()); | 576 sources_with_profile_.begin()); |
| 557 if (success) | 577 if (success) |
| 558 return true; | 578 return true; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // important to know how much total "jank" may be introduced. | 672 // important to know how much total "jank" may be introduced. |
| 653 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total"); | 673 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total"); |
| 654 | 674 |
| 655 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) { | 675 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) { |
| 656 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File"); | 676 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File"); |
| 657 MergeHistogramDeltasFromSource(source.get()); | 677 MergeHistogramDeltasFromSource(source.get()); |
| 658 } | 678 } |
| 659 } | 679 } |
| 660 | 680 |
| 661 } // namespace metrics | 681 } // namespace metrics |
| OLD | NEW |