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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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/blockfile/stats_histogram.h" 5 #include "net/disk_cache/blockfile/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"
11 #include "base/metrics/sample_vector.h" 11 #include "base/metrics/sample_vector.h"
12 #include "base/metrics/statistics_recorder.h" 12 #include "base/metrics/statistics_recorder.h"
13 #include "net/disk_cache/blockfile/stats.h" 13 #include "net/disk_cache/blockfile/stats.h"
14 14
15 namespace disk_cache { 15 namespace disk_cache {
16 16
17 using base::BucketRanges; 17 using base::BucketRanges;
18 using base::Histogram; 18 using base::Histogram;
19 using base::HistogramSamples; 19 using base::HistogramSamples;
20 using base::SampleVector; 20 using base::SampleVector;
21 using base::StatisticsRecorder; 21 using base::StatisticsRecorder;
22 22
23 StatsHistogram::StatsHistogram(const std::string& name, 23 StatsHistogram::StatsHistogram(const std::string& name,
24 Sample minimum, 24 Sample minimum,
25 Sample maximum, 25 Sample maximum,
26 const BucketRanges* ranges, 26 const BucketRanges* ranges,
27 const Stats* stats) 27 const Stats* stats)
28 : Histogram(name, minimum, maximum, ranges), 28 : Histogram(name, minimum, maximum, ranges), stats_(stats) {
29 stats_(stats) {} 29 }
30 30
31 StatsHistogram::~StatsHistogram() {} 31 StatsHistogram::~StatsHistogram() {
32 }
32 33
33 // static 34 // static
34 void StatsHistogram::InitializeBucketRanges(const Stats* stats, 35 void StatsHistogram::InitializeBucketRanges(const Stats* stats,
35 BucketRanges* ranges) { 36 BucketRanges* ranges) {
36 for (size_t i = 0; i < ranges->size(); ++i) { 37 for (size_t i = 0; i < ranges->size(); ++i) {
37 ranges->set_range(i, stats->GetBucketRange(i)); 38 ranges->set_range(i, stats->GetBucketRange(i));
38 } 39 }
39 ranges->ResetChecksum(); 40 ranges->ResetChecksum();
40 } 41 }
41 42
(...skipping 28 matching lines...) Expand all
70 return return_histogram; 71 return return_histogram;
71 } 72 }
72 73
73 void StatsHistogram::Disable() { 74 void StatsHistogram::Disable() {
74 stats_ = NULL; 75 stats_ = NULL;
75 } 76 }
76 77
77 scoped_ptr<HistogramSamples> StatsHistogram::SnapshotSamples() const { 78 scoped_ptr<HistogramSamples> StatsHistogram::SnapshotSamples() const {
78 scoped_ptr<SampleVector> samples(new SampleVector(bucket_ranges())); 79 scoped_ptr<SampleVector> samples(new SampleVector(bucket_ranges()));
79 if (stats_) 80 if (stats_)
80 stats_->Snapshot(samples.get()); 81 stats_->Snapshot(samples.get());
81 82
82 // Only report UMA data once. 83 // Only report UMA data once.
83 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this); 84 StatsHistogram* mutable_me = const_cast<StatsHistogram*>(this);
84 mutable_me->ClearFlags(kUmaTargetedHistogramFlag); 85 mutable_me->ClearFlags(kUmaTargetedHistogramFlag);
85 86
86 return samples.PassAs<HistogramSamples>(); 87 return samples.PassAs<HistogramSamples>();
87 } 88 }
88 89
89 int StatsHistogram::FindCorruption(const HistogramSamples& samples) const { 90 int StatsHistogram::FindCorruption(const HistogramSamples& samples) const {
90 // This class won't monitor inconsistencies. 91 // This class won't monitor inconsistencies.
91 return HistogramBase::NO_INCONSISTENCIES; 92 return HistogramBase::NO_INCONSISTENCIES;
92 } 93 }
93 94
94 } // namespace disk_cache 95 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698