| OLD | NEW |
| 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 #include "net/disk_cache/stats_histogram.h" | 5 #include "net/disk_cache/stats_histogram.h" |
| 6 | 6 |
| 7 #include "base/debug/leak_annotations.h" | 7 #include "base/debug/leak_annotations.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/bucket_ranges.h" | 9 #include "base/metrics/bucket_ranges.h" |
| 10 #include "base/metrics/histogram_base.h" | 10 #include "base/metrics/histogram_base.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 ranges->set_range(i, stats->GetBucketRange(i)); | 38 ranges->set_range(i, stats->GetBucketRange(i)); |
| 39 } | 39 } |
| 40 ranges->ResetChecksum(); | 40 ranges->ResetChecksum(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 StatsHistogram* StatsHistogram::FactoryGet(const std::string& name, | 43 StatsHistogram* StatsHistogram::FactoryGet(const std::string& name, |
| 44 const Stats* stats) { | 44 const Stats* stats) { |
| 45 Sample minimum = 1; | 45 Sample minimum = 1; |
| 46 Sample maximum = disk_cache::Stats::kDataSizesLength - 1; | 46 Sample maximum = disk_cache::Stats::kDataSizesLength - 1; |
| 47 size_t bucket_count = disk_cache::Stats::kDataSizesLength; | 47 size_t bucket_count = disk_cache::Stats::kDataSizesLength; |
| 48 Histogram* histogram = StatisticsRecorder::FindHistogram(name); | 48 HistogramBase* histogram = StatisticsRecorder::FindHistogram(name); |
| 49 if (!histogram) { | 49 if (!histogram) { |
| 50 DCHECK(stats); | 50 DCHECK(stats); |
| 51 | 51 |
| 52 // To avoid racy destruction at shutdown, the following will be leaked. | 52 // To avoid racy destruction at shutdown, the following will be leaked. |
| 53 BucketRanges* ranges = new BucketRanges(bucket_count + 1); | 53 BucketRanges* ranges = new BucketRanges(bucket_count + 1); |
| 54 InitializeBucketRanges(stats, ranges); | 54 InitializeBucketRanges(stats, ranges); |
| 55 const BucketRanges* registered_ranges = | 55 const BucketRanges* registered_ranges = |
| 56 StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges); | 56 StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges); |
| 57 | 57 |
| 58 // To avoid racy destruction at shutdown, the following will be leaked. | 58 // To avoid racy destruction at shutdown, the following will be leaked. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 76 scoped_ptr<SampleVector> samples(new SampleVector(bucket_ranges())); | 76 scoped_ptr<SampleVector> samples(new SampleVector(bucket_ranges())); |
| 77 stats_->Snapshot(samples.get()); | 77 stats_->Snapshot(samples.get()); |
| 78 | 78 |
| 79 // Only report UMA data once. | 79 // Only report UMA data once. |
| 80 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this); | 80 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this); |
| 81 mutable_me->ClearFlags(kUmaTargetedHistogramFlag); | 81 mutable_me->ClearFlags(kUmaTargetedHistogramFlag); |
| 82 | 82 |
| 83 return samples.PassAs<HistogramSamples>(); | 83 return samples.PassAs<HistogramSamples>(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 Histogram::Inconsistencies StatsHistogram::FindCorruption( | 86 int StatsHistogram::FindCorruption(const HistogramSamples& samples) const { |
| 87 const HistogramSamples& samples) const { | 87 // This class won't monitor inconsistencies. |
| 88 return NO_INCONSISTENCIES; // This class won't monitor inconsistencies. | 88 return HistogramBase::NO_INCONSISTENCIES; |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace disk_cache | 91 } // namespace disk_cache |
| OLD | NEW |