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

Side by Side Diff: base/metrics/histogram.cc

Issue 2955893002: Keep unlogged-samples object for minidump. (Closed)
Patch Set: move the debug/alias to the end of the method 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 // See header file for details and examples. 8 // See header file for details and examples.
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 608
609 std::unique_ptr<SampleVector> Histogram::SnapshotAllSamples() const { 609 std::unique_ptr<SampleVector> Histogram::SnapshotAllSamples() const {
610 std::unique_ptr<SampleVector> samples = SnapshotUnloggedSamples(); 610 std::unique_ptr<SampleVector> samples = SnapshotUnloggedSamples();
611 samples->Add(*logged_samples_); 611 samples->Add(*logged_samples_);
612 return samples; 612 return samples;
613 } 613 }
614 614
615 std::unique_ptr<SampleVector> Histogram::SnapshotUnloggedSamples() const { 615 std::unique_ptr<SampleVector> Histogram::SnapshotUnloggedSamples() const {
616 // TODO(bcwhite): Remove these CHECKs once crbug/734049 is resolved. 616 // TODO(bcwhite): Remove these CHECKs once crbug/734049 is resolved.
617 HistogramSamples* unlogged = unlogged_samples_.get();
617 CHECK(unlogged_samples_); 618 CHECK(unlogged_samples_);
618 CHECK(unlogged_samples_->id()); 619 CHECK(unlogged_samples_->id());
619 CHECK(bucket_ranges()); 620 CHECK(bucket_ranges());
620 std::unique_ptr<SampleVector> samples( 621 std::unique_ptr<SampleVector> samples(
621 new SampleVector(unlogged_samples_->id(), bucket_ranges())); 622 new SampleVector(unlogged_samples_->id(), bucket_ranges()));
622 samples->Add(*unlogged_samples_); 623 samples->Add(*unlogged_samples_);
624 debug::Alias(&unlogged);
623 return samples; 625 return samples;
624 } 626 }
625 627
626 void Histogram::WriteAsciiImpl(bool graph_it, 628 void Histogram::WriteAsciiImpl(bool graph_it,
627 const std::string& newline, 629 const std::string& newline,
628 std::string* output) const { 630 std::string* output) const {
629 // Get local (stack) copies of all effectively volatile class data so that we 631 // Get local (stack) copies of all effectively volatile class data so that we
630 // are consistent across our output activities. 632 // are consistent across our output activities.
631 std::unique_ptr<SampleVector> snapshot = SnapshotAllSamples(); 633 std::unique_ptr<SampleVector> snapshot = SnapshotAllSamples();
632 Count sample_count = snapshot->TotalCount(); 634 Count sample_count = snapshot->TotalCount();
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 Sample sample = custom_ranges[i]; 1223 Sample sample = custom_ranges[i];
1222 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) 1224 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1)
1223 return false; 1225 return false;
1224 if (sample != 0) 1226 if (sample != 0)
1225 has_valid_range = true; 1227 has_valid_range = true;
1226 } 1228 }
1227 return has_valid_range; 1229 return has_valid_range;
1228 } 1230 }
1229 1231
1230 } // namespace base 1232 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698