OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 flags_(kNoFlags), | 74 flags_(kNoFlags), |
75 ranges_(bucket_count + 1, 0), | 75 ranges_(bucket_count + 1, 0), |
76 sample_() { | 76 sample_() { |
77 Initialize(); | 77 Initialize(); |
78 } | 78 } |
79 | 79 |
80 Histogram::~Histogram() { | 80 Histogram::~Histogram() { |
81 if (StatisticsRecorder::dump_on_exit()) { | 81 if (StatisticsRecorder::dump_on_exit()) { |
82 std::string output; | 82 std::string output; |
83 WriteAscii(true, "\n", &output); | 83 WriteAscii(true, "\n", &output); |
84 LOG(INFO) << output; | 84 VLOG(1) << output; |
85 } | 85 } |
86 | 86 |
87 // Just to make sure most derived class did this properly... | 87 // Just to make sure most derived class did this properly... |
88 DCHECK(ValidateBucketRanges()); | 88 DCHECK(ValidateBucketRanges()); |
89 } | 89 } |
90 | 90 |
91 bool Histogram::PrintEmptyBucket(size_t index) const { | 91 bool Histogram::PrintEmptyBucket(size_t index) const { |
92 return true; | 92 return true; |
93 } | 93 } |
94 | 94 |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 467 |
468 if (histogram_type == HISTOGRAM) { | 468 if (histogram_type == HISTOGRAM) { |
469 render_histogram = Histogram::FactoryGet( | 469 render_histogram = Histogram::FactoryGet( |
470 histogram_name, declared_min, declared_max, bucket_count, flags); | 470 histogram_name, declared_min, declared_max, bucket_count, flags); |
471 } else if (histogram_type == LINEAR_HISTOGRAM) { | 471 } else if (histogram_type == LINEAR_HISTOGRAM) { |
472 render_histogram = LinearHistogram::FactoryGet( | 472 render_histogram = LinearHistogram::FactoryGet( |
473 histogram_name, declared_min, declared_max, bucket_count, flags); | 473 histogram_name, declared_min, declared_max, bucket_count, flags); |
474 } else if (histogram_type == BOOLEAN_HISTOGRAM) { | 474 } else if (histogram_type == BOOLEAN_HISTOGRAM) { |
475 render_histogram = BooleanHistogram::FactoryGet(histogram_name, flags); | 475 render_histogram = BooleanHistogram::FactoryGet(histogram_name, flags); |
476 } else { | 476 } else { |
477 LOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: " << | 477 LOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: " |
478 histogram_type; | 478 << histogram_type; |
479 return false; | 479 return false; |
480 } | 480 } |
481 | 481 |
482 DCHECK(declared_min == render_histogram->declared_min()); | 482 DCHECK(declared_min == render_histogram->declared_min()); |
483 DCHECK(declared_max == render_histogram->declared_max()); | 483 DCHECK(declared_max == render_histogram->declared_max()); |
484 DCHECK(bucket_count == render_histogram->bucket_count()); | 484 DCHECK(bucket_count == render_histogram->bucket_count()); |
485 DCHECK(histogram_type == render_histogram->histogram_type()); | 485 DCHECK(histogram_type == render_histogram->histogram_type()); |
486 | 486 |
487 if (render_histogram->flags() & kIPCSerializationSourceFlag) { | 487 if (render_histogram->flags() & kIPCSerializationSourceFlag) { |
488 DLOG(INFO) << "Single process mode, histogram observed and not copied: " << | 488 DVLOG(1) << "Single process mode, histogram observed and not copied: " |
489 histogram_name; | 489 << histogram_name; |
490 } else { | 490 } else { |
491 DCHECK(flags == (flags & render_histogram->flags())); | 491 DCHECK(flags == (flags & render_histogram->flags())); |
492 render_histogram->AddSampleSet(sample); | 492 render_histogram->AddSampleSet(sample); |
493 } | 493 } |
494 | 494 |
495 return true; | 495 return true; |
496 } | 496 } |
497 | 497 |
498 //------------------------------------------------------------------------------ | 498 //------------------------------------------------------------------------------ |
499 // Methods for the Histogram::SampleSet class | 499 // Methods for the Histogram::SampleSet class |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 lock_ = new Lock; | 807 lock_ = new Lock; |
808 histograms_ = new HistogramMap; | 808 histograms_ = new HistogramMap; |
809 } | 809 } |
810 | 810 |
811 StatisticsRecorder::~StatisticsRecorder() { | 811 StatisticsRecorder::~StatisticsRecorder() { |
812 DCHECK(histograms_); | 812 DCHECK(histograms_); |
813 | 813 |
814 if (dump_on_exit_) { | 814 if (dump_on_exit_) { |
815 std::string output; | 815 std::string output; |
816 WriteGraph("", &output); | 816 WriteGraph("", &output); |
817 LOG(INFO) << output; | 817 VLOG(1) << output; |
818 } | 818 } |
819 // Clean up. | 819 // Clean up. |
820 delete histograms_; | 820 delete histograms_; |
821 histograms_ = NULL; | 821 histograms_ = NULL; |
822 delete lock_; | 822 delete lock_; |
823 lock_ = NULL; | 823 lock_ = NULL; |
824 } | 824 } |
825 | 825 |
826 // static | 826 // static |
827 bool StatisticsRecorder::WasStarted() { | 827 bool StatisticsRecorder::WasStarted() { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 } | 926 } |
927 | 927 |
928 // static | 928 // static |
929 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 929 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
930 // static | 930 // static |
931 Lock* StatisticsRecorder::lock_ = NULL; | 931 Lock* StatisticsRecorder::lock_ = NULL; |
932 // static | 932 // static |
933 bool StatisticsRecorder::dump_on_exit_ = false; | 933 bool StatisticsRecorder::dump_on_exit_ = false; |
934 | 934 |
935 } // namespace base | 935 } // namespace base |
OLD | NEW |