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

Unified Diff: base/metrics/statistics_recorder.h

Issue 1880803003: Display histograms from subprocesses in chrome://histograms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 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/metrics/sparse_histogram.cc ('k') | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/statistics_recorder.h
diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h
index 6c436c292e6987027276e0cdee49e60787ba1280..fcbc02855b2ddbdd92c575465b3c9160d1395277 100644
--- a/base/metrics/statistics_recorder.h
+++ b/base/metrics/statistics_recorder.h
@@ -33,6 +33,26 @@ class Lock;
class BASE_EXPORT StatisticsRecorder {
public:
+ // An interface class for registering objects that can display histograms
+ // on the chrome://histograms page.
+ class MetricsDisplayer {
+ public:
+ enum DisplayType {
+ DISPLAY_TEXT_PLAIN,
+ DISPLAY_TEXT_HTML,
+ };
+
+ // Writes a title string (without formatting) to |output|.
+ virtual void WriteTitleString(std::string* output) = 0;
+
+ // Writes graphs for all known histograms to |output|, optionally with
+ // |html| formatting. If |query| is non-empty, only histograms with
+ // that substring will be included.
+ virtual void WriteGraphs(const std::string& query,
+ DisplayType format,
+ std::string* output) = 0;
+ };
+
// A class used as a key for the histogram map below. It always references
// a string owned outside of this class, likely in the value of the map.
class StringKey : public StringPiece {
@@ -165,6 +185,12 @@ class BASE_EXPORT StatisticsRecorder {
// Returns the number of known histograms.
static size_t GetHistogramCount();
+ // Adds an object that can display metrics.
+ static void RegisterMetricsDisplayer(MetricsDisplayer* display);
+
+ // Removes an object that can display metrics.
+ static void DeregisterMetricsDisplayer(MetricsDisplayer* display);
+
// Removes a histogram from the internal set of known ones. This can be
// necessary during testing persistent histograms where the underlying
// memory is being released.
« no previous file with comments | « base/metrics/sparse_histogram.cc ('k') | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698