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

Unified Diff: components/metrics/metrics_service.cc

Issue 1425533011: Support "shared" histograms between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: moved Create-Result histogram to private space and added to histograms.xml Created 4 years, 11 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 | « components/cronet/histogram_manager.cc ('k') | content/child/child_histogram_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/metrics_service.cc
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc
index 50545b3f68d2758e7307dac7edd23cb7d08a35e1..98c1456b3c6a934aa365d68a4aa917c6c0b9e77c 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -133,6 +133,7 @@
#include "base/location.h"
#include "base/metrics/histogram_base.h"
#include "base/metrics/histogram_macros.h"
+#include "base/metrics/histogram_persistence.h"
#include "base/metrics/histogram_samples.h"
#include "base/metrics/sparse_histogram.h"
#include "base/metrics/statistics_recorder.h"
@@ -740,6 +741,13 @@ void MetricsService::CloseCurrentLog() {
OpenNewLog(); // Start trivial log to hold our histograms.
}
+ // If a persistent allocator is in use, update its internal histograms (such
+ // as how much memory is being used) before reporting.
+ base::PersistentMemoryAllocator* allocator =
+ base::GetPersistentHistogramMemoryAllocator();
+ if (allocator)
+ allocator->UpdateTrackingHistograms();
+
// Put incremental data (histogram deltas, and realtime stats deltas) at the
// end of all log transmissions (initial log handles this separately).
// RecordIncrementalStabilityElements only exists on the derived
@@ -1099,13 +1107,19 @@ void MetricsService::RecordCurrentEnvironment(MetricsLog* log) {
void MetricsService::RecordCurrentHistograms() {
DCHECK(log_manager_.current_log());
+ // "true" indicates that StatisticsRecorder should include histograms in
+ // persistent storage.
histogram_snapshot_manager_.PrepareDeltas(
+ base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(),
base::Histogram::kNoFlags, base::Histogram::kUmaTargetedHistogramFlag);
}
void MetricsService::RecordCurrentStabilityHistograms() {
DCHECK(log_manager_.current_log());
+ // "true" indicates that StatisticsRecorder should include histograms in
+ // persistent storage.
histogram_snapshot_manager_.PrepareDeltas(
+ base::StatisticsRecorder::begin(true), base::StatisticsRecorder::end(),
base::Histogram::kNoFlags, base::Histogram::kUmaStabilityHistogramFlag);
}
« no previous file with comments | « components/cronet/histogram_manager.cc ('k') | content/child/child_histogram_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698