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

Unified Diff: components/metrics/profiler/tracking_synchronizer.h

Issue 985773002: Introducing phased profiling framework (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@write_to_file
Patch Set: Created 5 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
Index: components/metrics/profiler/tracking_synchronizer.h
diff --git a/components/metrics/profiler/tracking_synchronizer.h b/components/metrics/profiler/tracking_synchronizer.h
index fefe8d9457eb7c9e91798261f890cf3b7c9590d6..dfeb43f9a9b89d71a8d5fb6dfff84519baca3847 100644
--- a/components/metrics/profiler/tracking_synchronizer.h
+++ b/components/metrics/profiler/tracking_synchronizer.h
@@ -13,6 +13,8 @@
#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
+#include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
#include "content/public/browser/profiler_subscriber.h"
// This class maintains state that is used to upload profiler data from the
@@ -51,6 +53,11 @@ class TrackingSynchronizer
static void FetchProfilerDataAsynchronously(
const base::WeakPtr<TrackingSynchronizerObserver>& callback_object);
+ // Called when a profiling phase completes. |profiling_event| is the event
+ // associated with completing the phase and starting a new one.
+ static void OnProfilingPhaseCompletion(
+ ProfilerEventProto::ProfilerEvent profiling_event);
+
// ------------------------------------------------------
// ProfilerSubscriber methods for browser child processes
// ------------------------------------------------------
@@ -84,6 +91,11 @@ class TrackingSynchronizer
int RegisterAndNotifyAllProcesses(
const base::WeakPtr<TrackingSynchronizerObserver>& callback_object);
+ // Notifies all processes of a completion profiling phase. |profiling_event|
+ // is the event that caused the phase change.
+ void NotifyAllProcessesOfProfilingPhaseCompletion(
+ ProfilerEventProto::ProfilerEvent profiling_event);
+
// It finds the RequestContext for the given |sequence_number| and notifies
// the RequestContext's |callback_object_| about the |value|. This is called
// whenever we receive profiler data from processes. It also records that we
@@ -109,6 +121,19 @@ class TrackingSynchronizer
// reuse for a long time).
int last_used_sequence_number_;
+ // Sequence of events associated with already completed profiling phases. The
+ // index in the vector is the phase number. The current phase is not included.
+ std::vector<ProfilerEventProto::ProfilerEvent>
+ phase_completion_events_sequence_;
+
+ // Time of the profiling start. Used to calculate times of phase change
+ // moments relative to this value.
+ const base::TimeTicks start_time_;
+
+ // Times of starts of all profiling phases, including the current phase. The
+ // index in the vector is the phase number.
+ std::vector<base::TimeTicks> phase_start_times_;
+
DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizer);
};

Powered by Google App Engine
This is Rietveld 408576698