diff options
-rw-r--r-- | base/histogram.cc | 10 | ||||
-rw-r--r-- | base/histogram.h | 15 | ||||
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 1 | ||||
-rw-r--r-- | chrome/browser/spellchecker.cc | 1 | ||||
-rw-r--r-- | chrome/common/ipc_channel_posix.cc | 1 | ||||
-rw-r--r-- | chrome/common/ipc_channel_win.cc | 1 | ||||
-rw-r--r-- | chrome/renderer/renderer_main.cc | 1 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_webkit_init.h | 1 |
8 files changed, 17 insertions, 14 deletions
diff --git a/base/histogram.cc b/base/histogram.cc index d1568429..687a549 100644 --- a/base/histogram.cc +++ b/base/histogram.cc @@ -25,8 +25,7 @@ const int Histogram::kHexRangePrintingFlag = 0x8000; Histogram::Histogram(const char* name, Sample minimum, Sample maximum, size_t bucket_count) - : StatsRate(name), - histogram_name_(name), + : histogram_name_(name), declared_min_(minimum), declared_max_(maximum), bucket_count_(bucket_count), @@ -39,8 +38,7 @@ Histogram::Histogram(const char* name, Sample minimum, Histogram::Histogram(const char* name, TimeDelta minimum, TimeDelta maximum, size_t bucket_count) - : StatsRate(name), - histogram_name_(name), + : histogram_name_(name), declared_min_(static_cast<int> (minimum.InMilliseconds())), declared_max_(static_cast<int> (maximum.InMilliseconds())), bucket_count_(bucket_count), @@ -58,14 +56,11 @@ Histogram::~Histogram() { DCHECK(ValidateBucketRanges()); } -// Hooks to override stats counter methods. This ensures that we gather all -// input the stats counter sees. void Histogram::Add(int value) { if (!registered_) registered_ = StatisticsRecorder::Register(this); if (value >= kSampleType_MAX) value = kSampleType_MAX - 1; - StatsRate::Add(value); if (value < 0) value = 0; size_t index = BucketIndex(value); @@ -631,7 +626,6 @@ ThreadSafeHistogram::ThreadSafeHistogram(const char* name, Sample minimum, void ThreadSafeHistogram::Remove(int value) { if (value >= kSampleType_MAX) value = kSampleType_MAX - 1; - StatsRate::Add(-value); size_t index = BucketIndex(value); Accumulate(value, -1, index); } 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; } diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 547e3fa..00ee793 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -32,6 +32,7 @@ #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_nsautorelease_pool.h" +#include "base/stats_counters.h" #include "base/stats_table.h" #include "base/string_util.h" #if defined(OS_WIN) diff --git a/chrome/browser/spellchecker.cc b/chrome/browser/spellchecker.cc index 39aec18..91fc9c7 100644 --- a/chrome/browser/spellchecker.cc +++ b/chrome/browser/spellchecker.cc @@ -9,6 +9,7 @@ #include "base/histogram.h" #include "base/logging.h" #include "base/path_service.h" +#include "base/stats_counters.h" #include "base/string_util.h" #include "base/thread.h" #include "chrome/browser/browser_process.h" diff --git a/chrome/common/ipc_channel_posix.cc b/chrome/common/ipc_channel_posix.cc index 23c008a..71a1f44 100644 --- a/chrome/common/ipc_channel_posix.cc +++ b/chrome/common/ipc_channel_posix.cc @@ -22,6 +22,7 @@ #include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/singleton.h" +#include "base/stats_counters.h" #include "chrome/common/chrome_counters.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/file_descriptor_set_posix.h" diff --git a/chrome/common/ipc_channel_win.cc b/chrome/common/ipc_channel_win.cc index 38e442a..d4e7c31 100644 --- a/chrome/common/ipc_channel_win.cc +++ b/chrome/common/ipc_channel_win.cc @@ -10,6 +10,7 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/non_thread_safe.h" +#include "base/stats_counters.h" #include "base/win_util.h" #include "chrome/common/chrome_counters.h" #include "chrome/common/ipc_logging.h" diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index c6637ab..2295edb 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -9,6 +9,7 @@ #include "base/platform_thread.h" #include "base/process_util.h" #include "base/scoped_nsautorelease_pool.h" +#include "base/stats_counters.h" #include "base/string_util.h" #include "base/system_monitor.h" #include "chrome/common/chrome_constants.h" diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h index 6bba743..013d46f 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.h +++ b/webkit/tools/test_shell/test_shell_webkit_init.h @@ -5,6 +5,7 @@ #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ #define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_WEBKIT_INIT_H_ +#include "base/stats_counters.h" #include "base/string_util.h" #include "third_party/WebKit/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |