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

Unified Diff: components/startup_metric_utils/browser/startup_metric_utils.cc

Issue 2913423003: Refactor recording of the Startup.FirstWebContents.RenderProcessHostInit.ToNonEmptyPaint metric
Patch Set: Created 3 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 | « components/startup_metric_utils/browser/startup_metric_utils.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/startup_metric_utils/browser/startup_metric_utils.cc
diff --git a/components/startup_metric_utils/browser/startup_metric_utils.cc b/components/startup_metric_utils/browser/startup_metric_utils.cc
index f55f8907e00648b8e67d50e8d134959d2de385db..c60640f6dac1c81e27cccef20839e497b23e526a 100644
--- a/components/startup_metric_utils/browser/startup_metric_utils.cc
+++ b/components/startup_metric_utils/browser/startup_metric_utils.cc
@@ -47,6 +47,9 @@ base::LazyInstance<base::TimeTicks>::Leaky g_process_creation_ticks =
base::LazyInstance<base::TimeTicks>::Leaky g_browser_main_entry_point_ticks =
LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<base::TimeTicks>::Leaky
+ g_first_render_process_host_init_ticks = LAZY_INSTANCE_INITIALIZER;
+
base::LazyInstance<base::TimeTicks>::Leaky g_renderer_main_entry_point_ticks =
LAZY_INSTANCE_INITIALIZER;
@@ -698,6 +701,11 @@ void RecordBrowserOpenTabsDelta(base::TimeDelta delta) {
UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserOpenTabs", delta);
}
+void RecordFirstRenderProcessHostInit(base::TimeTicks ticks) {
+ if (g_first_render_process_host_init_ticks.Get().is_null())
+ g_first_render_process_host_init_ticks.Get() = ticks;
+}
+
void RecordRendererMainEntryTime(base::TimeTicks ticks) {
// Record the renderer main entry time, but don't log the UMA metric
// immediately because the startup temperature is not known yet.
@@ -718,11 +726,9 @@ void RecordFirstWebContentsMainFrameLoad(base::TimeTicks ticks) {
g_process_creation_ticks.Get(), ticks);
}
-void RecordFirstWebContentsNonEmptyPaint(
- base::TimeTicks now,
- base::TimeTicks render_process_host_init_time) {
+void RecordFirstWebContentsNonEmptyPaint(base::TimeTicks ticks) {
static bool is_first_call = true;
- if (!is_first_call || now.is_null())
+ if (!is_first_call || ticks.is_null())
return;
is_first_call = false;
@@ -737,16 +743,16 @@ void RecordFirstWebContentsNonEmptyPaint(
metrics::CallStackProfileMetricsProvider::FIRST_NONEMPTY_PAINT);
UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT(
UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.NonEmptyPaint2",
- g_process_creation_ticks.Get(), now);
+ g_process_creation_ticks.Get(), ticks);
UMA_HISTOGRAM_WITH_TEMPERATURE(
UMA_HISTOGRAM_LONG_TIMES_100,
"Startup.BrowserMessageLoopStart.To.NonEmptyPaint2",
- now - g_message_loop_start_ticks.Get());
+ ticks - g_message_loop_start_ticks.Get());
- UMA_HISTOGRAM_WITH_TEMPERATURE(
+ UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT(
gab 2017/06/02 18:31:33 Let's not bother with "AND_SAME_VERSION_COUNT" (we
UMA_HISTOGRAM_LONG_TIMES_100,
"Startup.FirstWebContents.RenderProcessHostInit.ToNonEmptyPaint",
- now - render_process_host_init_time);
+ g_first_render_process_host_init_ticks.Get(), ticks);
}
void RecordFirstWebContentsMainNavigationStart(base::TimeTicks ticks,
« no previous file with comments | « components/startup_metric_utils/browser/startup_metric_utils.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698