Lines Matching defs:Histogram
5 // Histogram is an object that aggregates statistics, and can summarize them in
10 #include "base/metrics/histogram.h"
48 DLOG(ERROR) << "Pickle error decoding Histogram: " << *histogram_name;
53 // checks above and beyond those in Histogram::Initialize()
59 DLOG(ERROR) << "Values error decoding Histogram: " << histogram_name;
63 // We use the arguments to find or create the local version of the histogram
71 bool ValidateRangeChecksum(const HistogramBase& histogram,
73 const Histogram& casted_histogram =
74 static_cast<const Histogram&>(histogram);
85 const size_t Histogram::kBucketCount_MAX = 16384u;
87 HistogramBase* Histogram::FactoryGet(const std::string& name,
96 HistogramBase* histogram = StatisticsRecorder::FindHistogram(name);
97 if (!histogram) {
104 Histogram* tentative_histogram =
105 new Histogram(name, minimum, maximum, registered_ranges);
108 histogram =
112 DCHECK_EQ(HISTOGRAM, histogram->GetHistogramType());
113 if (!histogram->HasConstructionArguments(minimum, maximum, bucket_count)) {
114 // The construction arguments do not match the existing histogram. This can
120 LOG(ERROR) << "Histogram " << name << " has bad construction arguments";
123 return histogram;
126 HistogramBase* Histogram::FactoryTimeGet(const std::string& name,
136 HistogramBase* Histogram::FactoryGet(const char* name,
144 HistogramBase* Histogram::FactoryTimeGet(const char* name,
163 void Histogram::InitializeBucketRanges(Sample minimum,
193 const int Histogram::kCommonRaceBasedCountMismatch = 5;
195 int Histogram::FindCorruption(const HistogramSamples& samples) const {
214 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentCountHigh", delta);
219 UMA_HISTOGRAM_COUNTS("Histogram.InconsistentCountLow", -delta);
227 Sample Histogram::ranges(size_t i) const {
231 size_t Histogram::bucket_count() const {
236 bool Histogram::InspectConstructionArguments(const std::string& name,
242 DVLOG(1) << "Histogram: " << name << " has bad minimum: " << *minimum;
246 DVLOG(1) << "Histogram: " << name << " has bad maximum: " << *maximum;
250 DVLOG(1) << "Histogram: " << name << " has bad bucket_count: "
264 uint64_t Histogram::name_hash() const {
268 HistogramType Histogram::GetHistogramType() const {
269 return HISTOGRAM;
272 bool Histogram::HasConstructionArguments(Sample expected_minimum,
280 void Histogram::Add(int value) {
284 void Histogram::AddCount(int value, int count) {
301 scoped_ptr<HistogramSamples> Histogram::SnapshotSamples() const {
305 void Histogram::AddSamples(const HistogramSamples& samples) {
309 bool Histogram::AddSamplesFromPickle(PickleIterator* iter) {
313 // The following methods provide a graphical histogram display.
314 void Histogram::WriteHTMLGraph(std::string* output) const {
321 void Histogram::WriteAscii(std::string* output) const {
325 bool Histogram::SerializeInfoImpl(Pickle* pickle) const {
335 Histogram::Histogram(const std::string& name,
347 Histogram::~Histogram() {
350 bool Histogram::PrintEmptyBucket(size_t /* index */) const {
354 // Use the actual bucket widths (like a linear histogram) until the widths get
359 double Histogram::GetBucketSize(Count current, size_t i) const {
368 const std::string Histogram::GetAsciiBucketRange(size_t i) const {
376 HistogramBase* Histogram::DeserializeInfoImpl(PickleIterator* iter) {
389 // Find or create the local version of the histogram in this process.
390 HistogramBase* histogram = Histogram::FactoryGet(
393 if (!ValidateRangeChecksum(*histogram, range_checksum)) {
394 // The serialized histogram might be corrupted.
397 return histogram;
400 scoped_ptr<SampleVector> Histogram::SnapshotSampleVector() const {
407 void Histogram::WriteAsciiImpl(bool graph_it,
424 // nearly the largest bucket range without sliding over the histogram.
444 // Output the actual histogram graph.
474 double Histogram::GetPeakBucketSize(const SampleVector& samples) const {
484 void Histogram::WriteAsciiHeader(const SampleVector& samples,
488 "Histogram: %s recorded %d samples",
502 void Histogram::WriteAsciiBucketContext(const int64_t past,
515 void Histogram::GetParameters(DictionaryValue* params) const {
522 void Histogram::GetCountAndBucketData(Count* count,
544 // LinearHistogram: This histogram uses a traditional set of evenly spaced
593 bool valid_arguments = Histogram::InspectConstructionArguments(
597 HistogramBase* histogram = StatisticsRecorder::FindHistogram(name);
598 if (!histogram) {
617 histogram =
621 DCHECK_EQ(LINEAR_HISTOGRAM, histogram->GetHistogramType());
622 if (!histogram->HasConstructionArguments(minimum, maximum, bucket_count)) {
623 // The construction arguments do not match the existing histogram. This can
629 LOG(ERROR) << "Histogram " << name << " has bad construction arguments";
632 return histogram;
643 : Histogram(name, minimum, maximum, ranges) {
649 // samples in a histogram if we didn't normalize this way.
658 return Histogram::GetAsciiBucketRange(i);
696 HistogramBase* histogram = LinearHistogram::FactoryGet(
698 if (!ValidateRangeChecksum(*histogram, range_checksum)) {
699 // The serialized histogram might be corrupted.
702 return histogram;
711 HistogramBase* histogram = StatisticsRecorder::FindHistogram(name);
712 if (!histogram) {
723 histogram =
727 DCHECK_EQ(BOOLEAN_HISTOGRAM, histogram->GetHistogramType());
728 return histogram;
756 HistogramBase* histogram = BooleanHistogram::FactoryGet(
758 if (!ValidateRangeChecksum(*histogram, range_checksum)) {
759 // The serialized histogram might be corrupted.
762 return histogram;
775 HistogramBase* histogram = StatisticsRecorder::FindHistogram(name);
776 if (!histogram) {
787 histogram =
791 DCHECK_EQ(histogram->GetHistogramType(), CUSTOM_HISTOGRAM);
792 return histogram;
823 : Histogram(name,
829 if (!Histogram::SerializeInfoImpl(pickle))
868 HistogramBase* histogram = CustomHistogram::FactoryGet(
870 if (!ValidateRangeChecksum(*histogram, range_checksum)) {
871 // The serialized histogram might be corrupted.
874 return histogram;