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

Unified Diff: chrome/browser/metrics/subprocess_metrics_provider.h

Issue 2023253002: Merge subprocess metrics into global StatisticsRecorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improved comment about when merges occur 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/statistics_recorder.h ('k') | chrome/browser/metrics/subprocess_metrics_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/subprocess_metrics_provider.h
diff --git a/chrome/browser/metrics/subprocess_metrics_provider.h b/chrome/browser/metrics/subprocess_metrics_provider.h
index d47f5846a3d7438a6aebfbbd1ea8c3d9db98788e..953169c8d8d34002de98100814c65f4c2df03d69 100644
--- a/chrome/browser/metrics/subprocess_metrics_provider.h
+++ b/chrome/browser/metrics/subprocess_metrics_provider.h
@@ -22,8 +22,10 @@ class PersistentHistogramAllocator;
class SharedPersistentMemoryAllocator;
}
-// SubprocessMetricsProvider gathers and logs histograms stored in shared
-// memory segments between processes.
+// SubprocessMetricsProvider gathers and merges histograms stored in shared
+// memory segments between processes. Merging occurs when a process exits,
+// when metrics are being collected for upload, or when something else needs
+// combined metrics (such as the chrome://histograms page).
class SubprocessMetricsProvider : public metrics::MetricsProvider,
public content::NotificationObserver,
public content::RenderProcessHostObserver {
@@ -44,18 +46,15 @@ class SubprocessMetricsProvider : public metrics::MetricsProvider,
// allocator it was using.
void DeregisterSubprocessAllocator(int id);
- // Report all histograms of a given allocator to the snapshot-manager.
- void RecordHistogramSnapshotsFromAllocator(
- base::HistogramSnapshotManager* snapshot_manager,
+ // Merge all histograms of a given allocator to the global StatisticsRecorder.
+ // This is called periodically during UMA metrics collection (if enabled) and
+ // possibly on-demand for other purposes.
+ void MergeHistogramDeltasFromAllocator(
int id,
base::PersistentHistogramAllocator* allocator);
// metrics::MetricsProvider:
- void OnDidCreateMetricsLog() override;
- void OnRecordingEnabled() override;
- void OnRecordingDisabled() override;
- void RecordHistogramSnapshots(
- base::HistogramSnapshotManager* snapshot_manager) override;
+ void MergeHistogramDeltas() override;
// content::NotificationObserver:
void Observe(int type,
@@ -79,21 +78,10 @@ class SubprocessMetricsProvider : public metrics::MetricsProvider,
IDMap<base::PersistentHistogramAllocator, IDMapOwnPointer, int>;
AllocatorByIdMap allocators_by_id_;
- // Allocators that are no longer attached to a subprocess, to be released
- // once the last data contained therein has been reported.
- std::vector<std::unique_ptr<base::PersistentHistogramAllocator>>
- allocators_for_exited_processes_;
- std::vector<std::unique_ptr<base::PersistentHistogramAllocator>>
- allocators_to_release_;
-
// Track all observed render processes to un-observe them on exit.
ScopedObserver<content::RenderProcessHost, SubprocessMetricsProvider>
scoped_observer_;
- // Flag indicating if metrics recording is enabled. Allocators will not
- // live past the death of the subprocess if it is not.
- bool metrics_recording_enabled_ = false;
-
DISALLOW_COPY_AND_ASSIGN(SubprocessMetricsProvider);
};
« no previous file with comments | « base/metrics/statistics_recorder.h ('k') | chrome/browser/metrics/subprocess_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698