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

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

Issue 10829466: SampleSet -> HistogramSamples (will be reused by SparseHistogram) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 #ifndef NET_DISK_CACHE_STATS_HISTOGRAM_H_ 5 #ifndef NET_DISK_CACHE_STATS_HISTOGRAM_H_
6 #define NET_DISK_CACHE_STATS_HISTOGRAM_H_ 6 #define NET_DISK_CACHE_STATS_HISTOGRAM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
11 12
13 namespace base {
14 class BucketRanges;
15 class SampleVector;
16 class HistogramSamples;
17 };
Ilya Sherman 2012/09/12 03:20:58 nit: No need for this semicolon
kaiwang 2012/09/20 22:54:59 Done.
18
12 namespace disk_cache { 19 namespace disk_cache {
13 20
14 class Stats; 21 class Stats;
15 22
16 // This class provides support for sending the disk cache size stats as a UMA 23 // This class provides support for sending the disk cache size stats as a UMA
17 // histogram. We'll provide our own storage and management for the data, and a 24 // histogram. We'll provide our own storage and management for the data, and a
18 // SampleSet with a copy of our data. 25 // SampleSet with a copy of our data.
19 // 26 //
20 // Class derivation of Histogram "deprecated," and should not be copied, and 27 // Class derivation of Histogram "deprecated," and should not be copied, and
21 // may eventually go away. 28 // may eventually go away.
Ilya Sherman 2012/09/12 03:20:58 Any chance of implementing this TODO and migrating
kaiwang 2012/09/20 22:54:59 Still have a more change needed. Feel free to file
22 // 29 //
23 class StatsHistogram : public base::Histogram { 30 class StatsHistogram : public base::Histogram {
24 public: 31 public:
25 class StatsSamples : public SampleSet {
26 public:
27 Counts* GetCounts() {
28 return &counts_;
29 }
30 };
31
32 StatsHistogram(const std::string& name, 32 StatsHistogram(const std::string& name,
33 Sample minimum, 33 Sample minimum,
34 Sample maximum, 34 Sample maximum,
35 size_t bucket_count) 35 size_t bucket_count,
36 : Histogram(name, minimum, maximum, bucket_count, NULL), init_(false) {} 36 base::BucketRanges* ranges,
37 const Stats* stats);
Ilya Sherman 2012/09/12 03:20:58 Can this have private visibility, since clients ar
Ilya Sherman 2012/09/21 08:52:12 Ping.
37 virtual ~StatsHistogram(); 38 virtual ~StatsHistogram();
38 39
39 static StatsHistogram* FactoryGet(const std::string& name); 40 static void InitializeBucketRanges(const Stats* stats,
41 base::BucketRanges* ranges);
Ilya Sherman 2012/09/12 03:20:58 nit: Can this be tucked into an anonymous namespac
Ilya Sherman 2012/09/21 08:52:12 Ping.
42 static StatsHistogram* FactoryGet(const std::string& name,
43 const Stats* stats);
40 44
41 // We'll be reporting data from the given set of cache stats. 45 virtual scoped_ptr<base::SampleVector> SnapshotSamples() const OVERRIDE;
42 bool Init(const Stats* stats);
43
44 virtual Sample ranges(size_t i) const OVERRIDE;
45 virtual size_t bucket_count() const OVERRIDE;
46 virtual void SnapshotSample(SampleSet* sample) const OVERRIDE;
47 virtual Inconsistencies FindCorruption( 46 virtual Inconsistencies FindCorruption(
48 const SampleSet& snapshot) const OVERRIDE; 47 const base::HistogramSamples& samples) const OVERRIDE;
49 48
50 private: 49 private:
51 bool init_; 50 const Stats* stats_;
Ilya Sherman 2012/09/12 03:20:58 nit: const Stats* const stats_?
Ilya Sherman 2012/09/21 08:52:12 Ping.
kaiwang 2012/09/21 19:51:18 For above 3 comments, I tried to follow the origin
52 static const Stats* stats_;
53 DISALLOW_COPY_AND_ASSIGN(StatsHistogram); 51 DISALLOW_COPY_AND_ASSIGN(StatsHistogram);
54 }; 52 };
55 53
56 } // namespace disk_cache 54 } // namespace disk_cache
57 55
58 #endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_ 56 #endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698