diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 23:51:25 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 23:51:25 +0000 |
commit | e2951cf3bd7e591a64ad5199a61531dac0ec58d2 (patch) | |
tree | 3039f816f6fa46008865c1ce4b1dd15de7b48d5a /net/disk_cache/stats_histogram.h | |
parent | 0e8db94aef1b57355c3d154cb4682ce2f94c51eb (diff) | |
download | chromium_src-e2951cf3bd7e591a64ad5199a61531dac0ec58d2.zip chromium_src-e2951cf3bd7e591a64ad5199a61531dac0ec58d2.tar.gz chromium_src-e2951cf3bd7e591a64ad5199a61531dac0ec58d2.tar.bz2 |
Use histograms to send interesting parts of the disk cache statistics.
Most of this CL deals with a derived implementation of histograms that just
queries the size stats already generated by the disk cache. The exact number
of buckets, and their distribution, is controlled directly by the new class and
the disk cache stats code.
Review URL: http://codereview.chromium.org/3069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2580 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/stats_histogram.h')
-rw-r--r-- | net/disk_cache/stats_histogram.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/net/disk_cache/stats_histogram.h b/net/disk_cache/stats_histogram.h new file mode 100644 index 0000000..4dd76cc --- /dev/null +++ b/net/disk_cache/stats_histogram.h @@ -0,0 +1,46 @@ +// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_DISK_CACHE_STATS_HISTOGRAM_H_ +#define NET_DISK_CACHE_STATS_HISTOGRAM_H_ + +#include "base/histogram.h" + +namespace disk_cache { + +class Stats; + +// This class provides support for sending the disk cache size stats as a UMA +// histogram. We'll provide our own storage and management for the data, and a +// SampleSet with a copy of our data. +class StatsHistogram : public Histogram { + public: + class StatsSamples : public SampleSet { + public: + Counts* GetCounts() { + return &counts_; + } + }; + + explicit StatsHistogram(const wchar_t* name) + : Histogram(name, 1, 1, 2), init_(false) {} + ~StatsHistogram(); + + // We'll be reporting data from the given set of cache stats. + bool Init(const Stats* stats); + + virtual Sample ranges(size_t i) const; + virtual size_t bucket_count() const; + virtual void SnapshotSample(SampleSet* sample) const; + + private: + bool init_; + static const Stats* stats_; + DISALLOW_COPY_AND_ASSIGN(StatsHistogram); +}; + +} // namespace disk_cache + +#endif // NET_DISK_CACHE_STATS_HISTOGRAM_H_ + |