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

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

Issue 1021053003: Delivering the FIRST_NONEMPTY_PAINT phase changing event to base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@phase_splitting
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.cc
diff --git a/components/metrics/profiler/tracking_synchronizer.cc b/components/metrics/profiler/tracking_synchronizer.cc
index 7f76704f0753cdd9bf77472d6e23442ad64e3470..d4889ce5fd31b6881283d0a8ad9b93754a205228 100644
--- a/components/metrics/profiler/tracking_synchronizer.cc
+++ b/components/metrics/profiler/tracking_synchronizer.cc
@@ -218,6 +218,20 @@ void TrackingSynchronizer::FetchProfilerDataAsynchronously(
base::TimeDelta::FromMinutes(1));
}
+// static
+void TrackingSynchronizer::OnProfilingPhaseCompletion(
+ ProfilerEventProto::ProfilerEvent profiling_event) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (!g_tracking_synchronizer) {
+ // System teardown is happening.
+ return;
+ }
+
+ g_tracking_synchronizer->NotifyAllProcessesOfProfilingPhaseCompletion(
+ profiling_event);
+}
+
void TrackingSynchronizer::OnPendingProcesses(int sequence_number,
int pending_processes,
bool end) {
@@ -252,18 +266,51 @@ int TrackingSynchronizer::RegisterAndNotifyAllProcesses(
// Increment pending process count for sending browser's profiler data.
request->IncrementProcessesPending();
+ int current_profiling_phase = phase_completion_events_sequence_.size();
+
// Get profiler data from renderer and browser child processes.
- content::ProfilerController::GetInstance()->GetProfilerData(sequence_number);
+ content::ProfilerController::GetInstance()->GetProfilerData(
+ sequence_number, current_profiling_phase);
// Send process data snapshot from browser process.
tracked_objects::ProcessDataSnapshot process_data_snapshot;
- tracked_objects::ThreadData::Snapshot(&process_data_snapshot);
+ tracked_objects::ThreadData::Snapshot(current_profiling_phase,
+ &process_data_snapshot);
+
DecrementPendingProcessesAndSendData(sequence_number, process_data_snapshot,
content::PROCESS_TYPE_BROWSER);
return sequence_number;
}
+void TrackingSynchronizer::RegisterPhaseCompletion(
+ ProfilerEventProto::ProfilerEvent profiling_event,
+ const base::TimeTicks& now) {
+ phase_completion_events_sequence_.push_back(profiling_event);
+ phase_start_times_.push_back(now);
+}
+
+void TrackingSynchronizer::NotifyAllProcessesOfProfilingPhaseCompletion(
+ ProfilerEventProto::ProfilerEvent profiling_event) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (variations::GetVariationParamValue("UMALogUploadInterval",
+ "send_split_profiles") != "true") {
+ return;
+ }
+
+ int profiling_phase = phase_completion_events_sequence_.size();
+
+ RegisterPhaseCompletion(profiling_event, base::TimeTicks::Now());
+
+ // Notify renderer and browser child processes.
+ content::ProfilerController::GetInstance()->OnProfilingPhaseCompletion(
+ profiling_phase);
+
+ // Notify browser process.
+ tracked_objects::ThreadData::OnProfilingPhaseCompletion(profiling_phase);
+}
+
void TrackingSynchronizer::SendData(
const tracked_objects::ProcessDataSnapshot& profiler_data,
content::ProcessType process_type,
« no previous file with comments | « components/metrics/profiler/tracking_synchronizer.h ('k') | components/metrics/profiler/tracking_synchronizer_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698