| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 "base/histogram.h" | 8 #include "base/histogram.h" |
| 9 | 9 |
| 10 namespace disk_cache { | 10 namespace disk_cache { |
| 11 | 11 |
| 12 class Stats; | 12 class Stats; |
| 13 | 13 |
| 14 // This class provides support for sending the disk cache size stats as a UMA | 14 // This class provides support for sending the disk cache size stats as a UMA |
| 15 // histogram. We'll provide our own storage and management for the data, and a | 15 // histogram. We'll provide our own storage and management for the data, and a |
| 16 // SampleSet with a copy of our data. | 16 // SampleSet with a copy of our data. |
| 17 class StatsHistogram : public Histogram { | 17 class StatsHistogram : public Histogram { |
| 18 public: | 18 public: |
| 19 class StatsSamples : public SampleSet { | 19 class StatsSamples : public SampleSet { |
| 20 public: | 20 public: |
| 21 Counts* GetCounts() { | 21 Counts* GetCounts() { |
| 22 return &counts_; | 22 return &counts_; |
| 23 } | 23 } |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 explicit StatsHistogram(const wchar_t* name) | 26 explicit StatsHistogram(const char* name) |
| 27 : Histogram(name, 1, 1, 2), init_(false) {} | 27 : Histogram(name, 1, 1, 2), init_(false) {} |
| 28 ~StatsHistogram(); | 28 ~StatsHistogram(); |
| 29 | 29 |
| 30 // We'll be reporting data from the given set of cache stats. | 30 // We'll be reporting data from the given set of cache stats. |
| 31 bool Init(const Stats* stats); | 31 bool Init(const Stats* stats); |
| 32 | 32 |
| 33 virtual Sample ranges(size_t i) const; | 33 virtual Sample ranges(size_t i) const; |
| 34 virtual size_t bucket_count() const; | 34 virtual size_t bucket_count() const; |
| 35 virtual void SnapshotSample(SampleSet* sample) const; | 35 virtual void SnapshotSample(SampleSet* sample) const; |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 bool init_; | 38 bool init_; |
| 39 static const Stats* stats_; | 39 static const Stats* stats_; |
| 40 DISALLOW_COPY_AND_ASSIGN(StatsHistogram); | 40 DISALLOW_COPY_AND_ASSIGN(StatsHistogram); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace disk_cache | 43 } // namespace disk_cache |
| 44 | 44 |
| 45 #endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_ | 45 #endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_ |
| 46 | |
| OLD | NEW |