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

Unified Diff: base/metrics/statistics_recorder.cc

Issue 1726873002: Report histogram creation results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 9 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/statistics_recorder.h ('k') | chrome/installer/setup/installer_metrics.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/statistics_recorder.cc
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
index d0fa2add3603b3f574dfa9ef9e5ee2e6b152aafc..2bb50ad3a33da3117475170fbefe152814c3e3e4 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -67,6 +67,15 @@ StatisticsRecorder::HistogramIterator::operator++() {
return *this;
}
+StatisticsRecorder::~StatisticsRecorder() {
+ DCHECK(lock_);
+ DCHECK(histograms_);
+ DCHECK(ranges_);
+
+ // Global clean up.
+ Reset();
+}
+
// static
void StatisticsRecorder::Initialize() {
// Ensure that an instance of the StatisticsRecorder object is created.
@@ -369,6 +378,17 @@ StatisticsRecorder::OnSampleCallback StatisticsRecorder::FindCallback(
}
// static
+size_t StatisticsRecorder::GetHistogramCount() {
+ if (!lock_)
+ return 0;
+
+ base::AutoLock auto_lock(*lock_);
+ if (!histograms_)
+ return 0;
+ return histograms_->size();
+}
+
+// static
void StatisticsRecorder::ResetForTesting() {
// Just call the private version that is used also by the destructor.
Reset();
@@ -403,13 +423,6 @@ StatisticsRecorder::StatisticsRecorder() {
AtExitManager::RegisterCallback(&DumpHistogramsToVlog, this);
}
-StatisticsRecorder::~StatisticsRecorder() {
- DCHECK(histograms_ && ranges_ && lock_);
-
- // Global clean up.
- Reset();
-}
-
// static
void StatisticsRecorder::Reset() {
// If there's no lock then there is nothing to reset.
« no previous file with comments | « base/metrics/statistics_recorder.h ('k') | chrome/installer/setup/installer_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698