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

Side by Side Diff: components/metrics/file_metrics_provider.cc

Issue 2938263002: Put BrowserMetrics with embedded profiles into subdir for auto-upload. (Closed)
Patch Set: use std::string::append() where possible Created 3 years, 5 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 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 411
412 source->read_complete = true; 412 source->read_complete = true;
413 DVLOG(1) << "Reported " << histogram_count << " histograms from " 413 DVLOG(1) << "Reported " << histogram_count << " histograms from "
414 << source->path.value(); 414 << source->path.value();
415 } 415 }
416 416
417 // static 417 // static
418 void FileMetricsProvider::RecordHistogramSnapshotsFromSource( 418 void FileMetricsProvider::RecordHistogramSnapshotsFromSource(
419 base::HistogramSnapshotManager* snapshot_manager, 419 base::HistogramSnapshotManager* snapshot_manager,
420 SourceInfo* source) { 420 SourceInfo* source) {
421 DCHECK_EQ(SOURCE_HISTOGRAMS_ATOMIC_FILE, source->type); 421 DCHECK_NE(SOURCE_HISTOGRAMS_ACTIVE_FILE, source->type);
422 422
423 base::PersistentHistogramAllocator::Iterator histogram_iter( 423 base::PersistentHistogramAllocator::Iterator histogram_iter(
424 source->allocator.get()); 424 source->allocator.get());
425 425
426 int histogram_count = 0; 426 int histogram_count = 0;
427 while (true) { 427 while (true) {
428 std::unique_ptr<base::HistogramBase> histogram = histogram_iter.GetNext(); 428 std::unique_ptr<base::HistogramBase> histogram = histogram_iter.GetNext();
429 if (!histogram) 429 if (!histogram)
430 break; 430 break;
431 snapshot_manager->PrepareFinalDelta(histogram.get()); 431 snapshot_manager->PrepareFinalDelta(histogram.get());
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } else { 547 } else {
548 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_DROPPED); 548 RecordEmbeddedProfileResult(EMBEDDED_PROFILE_DROPPED);
549 } 549 }
550 550
551 // Regardless of whether this source was successfully recorded, it is never 551 // Regardless of whether this source was successfully recorded, it is never
552 // read again. 552 // read again.
553 source->read_complete = true; 553 source->read_complete = true;
554 RecordSourceAsRead(source); 554 RecordSourceAsRead(source);
555 sources_to_check_.splice(sources_to_check_.end(), sources_with_profile_, 555 sources_to_check_.splice(sources_to_check_.end(), sources_with_profile_,
556 sources_with_profile_.begin()); 556 sources_with_profile_.begin());
557 ScheduleSourcesCheck();
558
557 if (success) 559 if (success)
558 return true; 560 return true;
559 } 561 }
560 562
561 return false; 563 return false;
562 } 564 }
563 565
564 bool FileMetricsProvider::HasInitialStabilityMetrics() { 566 bool FileMetricsProvider::HasInitialStabilityMetrics() {
565 DCHECK(thread_checker_.CalledOnValidThread()); 567 DCHECK(thread_checker_.CalledOnValidThread());
566 568
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 // important to know how much total "jank" may be introduced. 654 // important to know how much total "jank" may be introduced.
653 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total"); 655 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.Total");
654 656
655 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) { 657 for (std::unique_ptr<SourceInfo>& source : sources_mapped_) {
656 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File"); 658 SCOPED_UMA_HISTOGRAM_TIMER("UMA.FileMetricsProvider.SnapshotTime.File");
657 MergeHistogramDeltasFromSource(source.get()); 659 MergeHistogramDeltasFromSource(source.get());
658 } 660 }
659 } 661 }
660 662
661 } // namespace metrics 663 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/file_metrics_provider.h ('k') | components/metrics/file_metrics_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698