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

Unified Diff: base/metrics/statistics_recorder.h

Issue 1748403003: Log histograms on shutdown when verbose logging is on (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | base/metrics/statistics_recorder.cc » ('j') | base/metrics/statistics_recorder.cc » ('J')
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 36b2f308af30bf8bc52d23a7ddfd9af69d22ccc7..401a786a79beb1f3e3304065f36d04d33e3c742e 100644
--- a/base/metrics/statistics_recorder.h
+++ b/base/metrics/statistics_recorder.h
@@ -130,6 +130,14 @@ class BASE_EXPORT StatisticsRecorder {
// histogram. This method is thread safe.
static OnSampleCallback FindCallback(const std::string& histogram_name);
+ // Initializes logging histograms with --v=1. Safe to call several times.
+ // Is called from ctor but for browser it seems that it is more useful to
+ // start logging after statistics recorder, so we need to init log-on-shutdown
+ // later.
+ static void InitLogOnShutdown();
+
+ static bool VLogInitializedForTesting();
+
// Clears all of the known histograms and resets static variables to a
// state that allows a new initialization.
static void ResetForTesting();
@@ -157,6 +165,7 @@ class BASE_EXPORT StatisticsRecorder {
friend class SharedHistogramTest;
friend class SparseHistogramTest;
friend class StatisticsRecorderTest;
+ friend class StatisticsRecorderLoggingTestBase;
FRIEND_TEST_ALL_PREFIXES(HistogramDeltaSerializationTest,
DeserializeHistogramAndAddSamples);
@@ -166,6 +175,8 @@ class BASE_EXPORT StatisticsRecorder {
StatisticsRecorder();
~StatisticsRecorder();
+ void InitLogOnShutdownWithoutLock();
+
static void Reset();
static void DumpHistogramsToVlog(void* instance);
« no previous file with comments | « no previous file | base/metrics/statistics_recorder.cc » ('j') | base/metrics/statistics_recorder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698