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

Side by Side Diff: net/disk_cache/stats_histogram.cc

Issue 12207058: Connect SparseHistogram with the rest of stats system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/stats_histogram.h ('k') | net/socket_stream/socket_stream_metrics_unittest.cc » ('j') | 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 #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
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
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
OLDNEW
« no previous file with comments | « net/disk_cache/stats_histogram.h ('k') | net/socket_stream/socket_stream_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698