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

Unified Diff: base/metrics/histogram.h

Issue 10703037: Move StatisticsRecorder out of histogram.cc/h for further refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop.cc ('k') | base/metrics/histogram.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.h
===================================================================
--- base/metrics/histogram.h (revision 146394)
+++ base/metrics/histogram.h (working copy)
@@ -40,7 +40,6 @@
#ifndef BASE_METRICS_HISTOGRAM_H_
#define BASE_METRICS_HISTOGRAM_H_
-#include <list>
#include <map>
#include <string>
#include <vector>
@@ -774,90 +773,6 @@
DISALLOW_COPY_AND_ASSIGN(CustomHistogram);
};
-//------------------------------------------------------------------------------
-// StatisticsRecorder handles all histograms in the system. It provides a
-// general place for histograms to register, and supports a global API for
-// accessing (i.e., dumping, or graphing) the data in all the histograms.
-
-class BASE_EXPORT StatisticsRecorder {
- public:
- typedef std::vector<Histogram*> Histograms;
-
- StatisticsRecorder();
-
- ~StatisticsRecorder();
-
- // Find out if histograms can now be registered into our list.
- static bool IsActive();
-
- // Register, or add a new histogram to the collection of statistics. If an
- // identically named histogram is already registered, then the argument
- // |histogram| will deleted. The returned value is always the registered
- // histogram (either the argument, or the pre-existing registered histogram).
- static Histogram* RegisterOrDeleteDuplicate(Histogram* histogram);
-
- // Register, or add a new cached_ranges_ of |histogram|. If an identical
- // cached_ranges_ is already registered, then the cached_ranges_ of
- // |histogram| is deleted and the |histogram|'s cached_ranges_ is reset to the
- // registered cached_ranges_. The cached_ranges_ of |histogram| is always the
- // registered CachedRanges (either the argument's cached_ranges_, or the
- // pre-existing registered cached_ranges_).
- static void RegisterOrDeleteDuplicateRanges(Histogram* histogram);
-
- // Method for collecting stats about histograms created in browser and
- // renderer processes. |suffix| is appended to histogram names. |suffix| could
- // be either browser or renderer.
- static void CollectHistogramStats(const std::string& suffix);
-
- // Methods for printing histograms. Only histograms which have query as
- // a substring are written to output (an empty string will process all
- // registered histograms).
- static void WriteHTMLGraph(const std::string& query, std::string* output);
- static void WriteGraph(const std::string& query, std::string* output);
-
- // Method for extracting histograms which were marked for use by UMA.
- static void GetHistograms(Histograms* output);
-
- // Find a histogram by name. It matches the exact name. This method is thread
- // safe. If a matching histogram is not found, then the |histogram| is
- // not changed.
- static bool FindHistogram(const std::string& query, Histogram** histogram);
-
- static bool dump_on_exit() { return dump_on_exit_; }
-
- static void set_dump_on_exit(bool enable) { dump_on_exit_ = enable; }
-
- // GetSnapshot copies some of the pointers to registered histograms into the
- // caller supplied vector (Histograms). Only histograms with names matching
- // query are returned. The query must be a substring of histogram name for its
- // pointer to be copied.
- static void GetSnapshot(const std::string& query, Histograms* snapshot);
-
-
- private:
- // We keep all registered histograms in a map, from name to histogram.
- typedef std::map<std::string, Histogram*> HistogramMap;
-
- // We keep all |cached_ranges_| in a map, from checksum to a list of
- // |cached_ranges_|. Checksum is calculated from the |ranges_| in
- // |cached_ranges_|.
- typedef std::map<uint32, std::list<CachedRanges*>*> RangesMap;
-
- static HistogramMap* histograms_;
-
- static RangesMap* ranges_;
-
- // lock protects access to the above map.
- static base::Lock* lock_;
-
- // Dump all known histograms to log.
- static bool dump_on_exit_;
-
- DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder);
-};
-
-//------------------------------------------------------------------------------
-
// CachedRanges stores the Ranges vector. Histograms that have same Ranges
// vector will use the same CachedRanges object.
class BASE_EXPORT CachedRanges {
« no previous file with comments | « base/message_loop.cc ('k') | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698