| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 registered_histogram.get() != histogram.get()) | 41 registered_histogram.get() != histogram.get()) |
| 42 histogram = registered_histogram; | 42 histogram = registered_histogram; |
| 43 } | 43 } |
| 44 | 44 |
| 45 DCHECK(HISTOGRAM == histogram->histogram_type()); | 45 DCHECK(HISTOGRAM == histogram->histogram_type()); |
| 46 DCHECK(histogram->HasConstructorArguments(minimum, maximum, bucket_count)); | 46 DCHECK(histogram->HasConstructorArguments(minimum, maximum, bucket_count)); |
| 47 histogram->SetFlags(flags); | 47 histogram->SetFlags(flags); |
| 48 return histogram; | 48 return histogram; |
| 49 } | 49 } |
| 50 | 50 |
| 51 scoped_refptr<Histogram> Histogram::FactoryGet(const std::string& name, | 51 scoped_refptr<Histogram> Histogram::FactoryTimeGet(const std::string& name, |
| 52 base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count, | 52 base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count, |
| 53 Flags flags) { | 53 Flags flags) { |
| 54 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), | 54 return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), |
| 55 bucket_count, flags); | 55 bucket_count, flags); |
| 56 } | 56 } |
| 57 | 57 |
| 58 Histogram::Histogram(const std::string& name, Sample minimum, | 58 Histogram::Histogram(const std::string& name, Sample minimum, |
| 59 Sample maximum, size_t bucket_count) | 59 Sample maximum, size_t bucket_count) |
| 60 : histogram_name_(name), | 60 : histogram_name_(name), |
| 61 declared_min_(minimum), | 61 declared_min_(minimum), |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 LOG(ERROR) << "Values error decoding Histogram: " << histogram_name; | 433 LOG(ERROR) << "Values error decoding Histogram: " << histogram_name; |
| 434 return false; | 434 return false; |
| 435 } | 435 } |
| 436 | 436 |
| 437 Flags flags = static_cast<Flags>(pickle_flags & ~kIPCSerializationSourceFlag); | 437 Flags flags = static_cast<Flags>(pickle_flags & ~kIPCSerializationSourceFlag); |
| 438 | 438 |
| 439 DCHECK(histogram_type != NOT_VALID_IN_RENDERER); | 439 DCHECK(histogram_type != NOT_VALID_IN_RENDERER); |
| 440 | 440 |
| 441 scoped_refptr<Histogram> render_histogram(NULL); | 441 scoped_refptr<Histogram> render_histogram(NULL); |
| 442 | 442 |
| 443 if (histogram_type == HISTOGRAM) { | 443 if (histogram_type == HISTOGRAM) { |
| 444 render_histogram = Histogram::FactoryGet( | 444 render_histogram = Histogram::FactoryGet( |
| 445 histogram_name, declared_min, declared_max, bucket_count, flags); | 445 histogram_name, declared_min, declared_max, bucket_count, flags); |
| 446 } else if (histogram_type == LINEAR_HISTOGRAM) { | 446 } else if (histogram_type == LINEAR_HISTOGRAM) { |
| 447 render_histogram = LinearHistogram::FactoryGet( | 447 render_histogram = LinearHistogram::FactoryGet( |
| 448 histogram_name, declared_min, declared_max, bucket_count, flags); | 448 histogram_name, declared_min, declared_max, bucket_count, flags); |
| 449 } else if (histogram_type == BOOLEAN_HISTOGRAM) { | 449 } else if (histogram_type == BOOLEAN_HISTOGRAM) { |
| 450 render_histogram = BooleanHistogram::FactoryGet(histogram_name, flags); | 450 render_histogram = BooleanHistogram::FactoryGet(histogram_name, flags); |
| 451 } else { | 451 } else { |
| 452 LOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: " << | 452 LOG(ERROR) << "Error Deserializing Histogram Unknown histogram_type: " << |
| 453 histogram_type; | 453 histogram_type; |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 snapshot->push_back(it->second); | 886 snapshot->push_back(it->second); |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 | 889 |
| 890 // static | 890 // static |
| 891 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; | 891 StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; |
| 892 // static | 892 // static |
| 893 Lock* StatisticsRecorder::lock_ = NULL; | 893 Lock* StatisticsRecorder::lock_ = NULL; |
| 894 // static | 894 // static |
| 895 bool StatisticsRecorder::dump_on_exit_ = false; | 895 bool StatisticsRecorder::dump_on_exit_ = false; |
| OLD | NEW |