summaryrefslogtreecommitdiffstats
path: root/base/histogram.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-10 22:29:29 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-10 22:29:29 +0000
commite6f02aba72e297560ece0e79d165abf4c49149ff (patch)
tree95fb68ad511b0ac62e2532c47f46362afff39f88 /base/histogram.h
parentcaae50cacfe0304045b9a961af797e3cf38bde23 (diff)
downloadchromium_src-e6f02aba72e297560ece0e79d165abf4c49149ff.zip
chromium_src-e6f02aba72e297560ece0e79d165abf4c49149ff.tar.gz
chromium_src-e6f02aba72e297560ece0e79d165abf4c49149ff.tar.bz2
Remove histogram connection to base classes in stats_counter
Now that histograms move data from renderer to browser, there is less reason to connect to stats counters. Stats counters were using shared memory, and now they may plausibly use the histogram's IPC mechanism instead to move data to the browser. The first step is remove the inheritance, and teh next (plausible/future) step would be to implement counters as histograms with only one bucket. r=mbelshe Review URL: http://codereview.chromium.org/66029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/histogram.h')
-rw-r--r--base/histogram.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/base/histogram.h b/base/histogram.h
index 0773a7a..59981ea 100644
--- a/base/histogram.h
+++ b/base/histogram.h
@@ -36,7 +36,7 @@
#include <vector>
#include "base/lock.h"
-#include "base/stats_counters.h"
+#include "base/time.h"
//------------------------------------------------------------------------------
// Provide easy general purpose histogram in a macro, just like stats counters.
@@ -203,7 +203,7 @@ static const int kRendererHistogramFlag = 1 << 4;
class Pickle;
-class Histogram : public StatsRate {
+class Histogram {
public:
typedef int Sample; // Used for samples (and ranges of samples).
typedef int Count; // Used to count samples in a bucket.
@@ -263,9 +263,11 @@ class Histogram : public StatsRate {
base::TimeDelta maximum, size_t bucket_count);
virtual ~Histogram();
- // Hooks to override stats counter methods. This ensures that we gather all
- // input the stats counter sees.
- virtual void Add(int value);
+ void Add(int value);
+ // Accept a TimeDelta to increment.
+ void AddTime(base::TimeDelta time) {
+ Add(static_cast<int>(time.InMilliseconds()));
+ }
void AddSampleSet(const SampleSet& sample);
@@ -465,7 +467,7 @@ class BooleanHistogram : public LinearHistogram {
: LinearHistogram(name, 0, 2, 3) {
}
- virtual void AddBoolean(bool value) { Add(value ? 1 : 0); }
+ void AddBoolean(bool value) { Add(value ? 1 : 0); }
private:
DISALLOW_COPY_AND_ASSIGN(BooleanHistogram);
@@ -526,6 +528,7 @@ class StatisticsRecorder {
// Method for extracting histograms which were marked for use by UMA.
static void GetHistograms(Histograms* output);
+ // Find a histogram by name. This method is thread safe.
static Histogram* GetHistogram(const std::string& query);
static void set_dump_on_exit(bool enable) { dump_on_exit_ = enable; }