OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 5 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
6 | 6 |
7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Mark as volatile to defensively make sure usage is thread-safe. | 26 // Mark as volatile to defensively make sure usage is thread-safe. |
27 // Note that at the time of this writing, access is only on the UI thread. | 27 // Note that at the time of this writing, access is only on the UI thread. |
28 volatile bool g_non_browser_ui_displayed = false; | 28 volatile bool g_non_browser_ui_displayed = false; |
29 | 29 |
30 base::LazyInstance<base::TimeTicks>::Leaky g_process_creation_ticks = | 30 base::LazyInstance<base::TimeTicks>::Leaky g_process_creation_ticks = |
31 LAZY_INSTANCE_INITIALIZER; | 31 LAZY_INSTANCE_INITIALIZER; |
32 | 32 |
33 base::LazyInstance<base::TimeTicks>::Leaky g_main_entry_point_ticks = | 33 base::LazyInstance<base::TimeTicks>::Leaky g_browser_main_entry_point_ticks = |
| 34 LAZY_INSTANCE_INITIALIZER; |
| 35 |
| 36 base::LazyInstance<base::TimeTicks>::Leaky g_renderer_main_entry_point_ticks = |
34 LAZY_INSTANCE_INITIALIZER; | 37 LAZY_INSTANCE_INITIALIZER; |
35 | 38 |
36 // Only used by RecordMainEntryTimeHistogram(), should go away with it (do not | 39 // Only used by RecordMainEntryTimeHistogram(), should go away with it (do not |
37 // add new uses of this), see crbug.com/317481 for discussion on why it was kept | 40 // add new uses of this), see crbug.com/317481 for discussion on why it was kept |
38 // as-is for now. | 41 // as-is for now. |
39 base::LazyInstance<base::Time>::Leaky g_main_entry_point_time = | 42 base::LazyInstance<base::Time>::Leaky g_browser_main_entry_point_time = |
40 LAZY_INSTANCE_INITIALIZER; | 43 LAZY_INSTANCE_INITIALIZER; |
41 | 44 |
42 StartupTemperature g_startup_temperature = UNCERTAIN_STARTUP_TEMPERATURE; | 45 StartupTemperature g_startup_temperature = UNCERTAIN_STARTUP_TEMPERATURE; |
43 | 46 |
44 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
45 | 48 |
46 // These values are taken from the Startup.BrowserMessageLoopStartHardFaultCount | 49 // These values are taken from the Startup.BrowserMessageLoopStartHardFaultCount |
47 // histogram. If the cold start histogram starts looking strongly bimodal it may | 50 // histogram. If the cold start histogram starts looking strongly bimodal it may |
48 // be because the binary/resource sizes have grown significantly larger than | 51 // be because the binary/resource sizes have grown significantly larger than |
49 // when these values were set. In this case the new values need to be chosen | 52 // when these values were set. In this case the new values need to be chosen |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Helper macro for splitting out an UMA histogram based on cold or warm start. | 166 // Helper macro for splitting out an UMA histogram based on cold or warm start. |
164 // |type| is the histogram type, and corresponds to an UMA macro like | 167 // |type| is the histogram type, and corresponds to an UMA macro like |
165 // UMA_HISTOGRAM_LONG_TIMES. It must be itself be a macro that only takes two | 168 // UMA_HISTOGRAM_LONG_TIMES. It must be itself be a macro that only takes two |
166 // parameters. | 169 // parameters. |
167 // |basename| is the basename of the histogram. A histogram of this name will | 170 // |basename| is the basename of the histogram. A histogram of this name will |
168 // always be recorded to. If the startup is either cold or warm then a value | 171 // always be recorded to. If the startup is either cold or warm then a value |
169 // will also be recorded to the histogram with name |basename| and suffix | 172 // will also be recorded to the histogram with name |basename| and suffix |
170 // ".ColdStart" or ".WarmStart", as appropriate. | 173 // ".ColdStart" or ".WarmStart", as appropriate. |
171 // |value_expr| is an expression evaluating to the value to be recorded. This | 174 // |value_expr| is an expression evaluating to the value to be recorded. This |
172 // will be evaluated exactly once and cached, so side effects are not an issue. | 175 // will be evaluated exactly once and cached, so side effects are not an issue. |
| 176 // A metric logged using this macro must have an affected-histogram entry in the |
| 177 // definition of the StartupTemperature suffix in histograms.xml. |
173 #define UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(type, basename, value_expr) \ | 178 #define UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(type, basename, value_expr) \ |
174 { \ | 179 { \ |
175 const auto kValue = value_expr; \ | 180 const auto kValue = value_expr; \ |
176 /* Always record to the base histogram. */ \ | 181 /* Always record to the base histogram. */ \ |
177 type(basename, kValue); \ | 182 type(basename, kValue); \ |
178 /* Record to the cold/warm suffixed histogram as appropriate. */ \ | 183 /* Record to the cold/warm suffixed histogram as appropriate. */ \ |
179 if (g_startup_temperature == COLD_STARTUP_TEMPERATURE) { \ | 184 if (g_startup_temperature == COLD_STARTUP_TEMPERATURE) { \ |
180 type(basename ".ColdStartup", kValue); \ | 185 type(basename ".ColdStartup", kValue); \ |
181 } else if (g_startup_temperature == WARM_STARTUP_TEMPERATURE) { \ | 186 } else if (g_startup_temperature == WARM_STARTUP_TEMPERATURE) { \ |
182 type(basename ".WarmStartup", kValue); \ | 187 type(basename ".WarmStartup", kValue); \ |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // conversion. | 296 // conversion. |
292 const base::TimeDelta delta_since_base = time_base - time; | 297 const base::TimeDelta delta_since_base = time_base - time; |
293 return trace_ticks_base - delta_since_base; | 298 return trace_ticks_base - delta_since_base; |
294 } | 299 } |
295 | 300 |
296 // Record time of main entry so it can be read from Telemetry performance tests. | 301 // Record time of main entry so it can be read from Telemetry performance tests. |
297 // TODO(jeremy): Remove once crbug.com/317481 is fixed. | 302 // TODO(jeremy): Remove once crbug.com/317481 is fixed. |
298 void RecordMainEntryTimeHistogram() { | 303 void RecordMainEntryTimeHistogram() { |
299 const int kLowWordMask = 0xFFFFFFFF; | 304 const int kLowWordMask = 0xFFFFFFFF; |
300 const int kLower31BitsMask = 0x7FFFFFFF; | 305 const int kLower31BitsMask = 0x7FFFFFFF; |
301 DCHECK(!g_main_entry_point_time.Get().is_null()); | 306 DCHECK(!g_browser_main_entry_point_time.Get().is_null()); |
302 const base::TimeDelta browser_main_entry_time_absolute = | 307 const base::TimeDelta browser_main_entry_time_absolute = |
303 g_main_entry_point_time.Get() - base::Time::UnixEpoch(); | 308 g_browser_main_entry_point_time.Get() - base::Time::UnixEpoch(); |
304 | 309 |
305 const uint64 browser_main_entry_time_raw_ms = | 310 const uint64 browser_main_entry_time_raw_ms = |
306 browser_main_entry_time_absolute.InMilliseconds(); | 311 browser_main_entry_time_absolute.InMilliseconds(); |
307 | 312 |
308 const base::TimeDelta browser_main_entry_time_raw_ms_high_word = | 313 const base::TimeDelta browser_main_entry_time_raw_ms_high_word = |
309 base::TimeDelta::FromMilliseconds( | 314 base::TimeDelta::FromMilliseconds( |
310 (browser_main_entry_time_raw_ms >> 32) & kLowWordMask); | 315 (browser_main_entry_time_raw_ms >> 32) & kLowWordMask); |
311 // Shift by one because histograms only support non-negative values. | 316 // Shift by one because histograms only support non-negative values. |
312 const base::TimeDelta browser_main_entry_time_raw_ms_low_word = | 317 const base::TimeDelta browser_main_entry_time_raw_ms_low_word = |
313 base::TimeDelta::FromMilliseconds( | 318 base::TimeDelta::FromMilliseconds( |
314 (browser_main_entry_time_raw_ms >> 1) & kLower31BitsMask); | 319 (browser_main_entry_time_raw_ms >> 1) & kLower31BitsMask); |
315 | 320 |
316 // A timestamp is a 64 bit value, yet histograms can only store 32 bits. | 321 // A timestamp is a 64 bit value, yet histograms can only store 32 bits. |
317 LOCAL_HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteHighWord", | 322 LOCAL_HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteHighWord", |
318 browser_main_entry_time_raw_ms_high_word); | 323 browser_main_entry_time_raw_ms_high_word); |
319 LOCAL_HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteLowWord", | 324 LOCAL_HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteLowWord", |
320 browser_main_entry_time_raw_ms_low_word); | 325 browser_main_entry_time_raw_ms_low_word); |
321 } | 326 } |
322 | 327 |
| 328 // Record renderer main entry time histogram. |
| 329 void RecordRendererMainEntryHistogram() { |
| 330 const base::TimeTicks& browser_main_entry_point_ticks = |
| 331 g_browser_main_entry_point_ticks.Get(); |
| 332 const base::TimeTicks& renderer_main_entry_point_ticks = |
| 333 g_renderer_main_entry_point_ticks.Get(); |
| 334 |
| 335 if (!browser_main_entry_point_ticks.is_null() && |
| 336 !renderer_main_entry_point_ticks.is_null()) { |
| 337 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
| 338 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMainToRendererMain", |
| 339 browser_main_entry_point_ticks, renderer_main_entry_point_ticks); |
| 340 } |
| 341 } |
| 342 |
323 // Environment variable that stores the timestamp when the executable's main() | 343 // Environment variable that stores the timestamp when the executable's main() |
324 // function was entered in TimeTicks. This is required because chrome.exe and | 344 // function was entered in TimeTicks. This is required because chrome.exe and |
325 // chrome.dll don't share the same static storage. | 345 // chrome.dll don't share the same static storage. |
326 const char kChromeMainTicksEnvVar[] = "CHROME_MAIN_TICKS"; | 346 const char kChromeMainTicksEnvVar[] = "CHROME_MAIN_TICKS"; |
327 | 347 |
328 // Returns the time of main entry recorded from RecordExeMainEntryTime. | 348 // Returns the time of main entry recorded from RecordExeMainEntryTime. |
329 base::TimeTicks ExeMainEntryPointTicks() { | 349 base::TimeTicks ExeMainEntryPointTicks() { |
330 scoped_ptr<base::Environment> env(base::Environment::Create()); | 350 scoped_ptr<base::Environment> env(base::Environment::Create()); |
331 std::string ticks_string; | 351 std::string ticks_string; |
332 int64 time_int = 0; | 352 int64 time_int = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
347 g_non_browser_ui_displayed = true; | 367 g_non_browser_ui_displayed = true; |
348 } | 368 } |
349 | 369 |
350 void RecordStartupProcessCreationTime(const base::Time& time) { | 370 void RecordStartupProcessCreationTime(const base::Time& time) { |
351 DCHECK(g_process_creation_ticks.Get().is_null()); | 371 DCHECK(g_process_creation_ticks.Get().is_null()); |
352 g_process_creation_ticks.Get() = StartupTimeToTimeTicks(time); | 372 g_process_creation_ticks.Get() = StartupTimeToTimeTicks(time); |
353 DCHECK(!g_process_creation_ticks.Get().is_null()); | 373 DCHECK(!g_process_creation_ticks.Get().is_null()); |
354 } | 374 } |
355 | 375 |
356 void RecordMainEntryPointTime(const base::Time& time) { | 376 void RecordMainEntryPointTime(const base::Time& time) { |
357 DCHECK(g_main_entry_point_ticks.Get().is_null()); | 377 DCHECK(g_browser_main_entry_point_ticks.Get().is_null()); |
358 g_main_entry_point_ticks.Get() = StartupTimeToTimeTicks(time); | 378 g_browser_main_entry_point_ticks.Get() = StartupTimeToTimeTicks(time); |
359 DCHECK(!g_main_entry_point_ticks.Get().is_null()); | 379 DCHECK(!g_browser_main_entry_point_ticks.Get().is_null()); |
360 | 380 |
361 // TODO(jeremy): Remove this with RecordMainEntryTimeHistogram() when | 381 // TODO(jeremy): Remove this with RecordMainEntryTimeHistogram() when |
362 // resolving crbug.com/317481. | 382 // resolving crbug.com/317481. |
363 DCHECK(g_main_entry_point_time.Get().is_null()); | 383 DCHECK(g_browser_main_entry_point_time.Get().is_null()); |
364 g_main_entry_point_time.Get() = time; | 384 g_browser_main_entry_point_time.Get() = time; |
365 DCHECK(!g_main_entry_point_time.Get().is_null()); | 385 DCHECK(!g_browser_main_entry_point_time.Get().is_null()); |
366 } | 386 } |
367 | 387 |
368 void RecordExeMainEntryPointTime(const base::Time& time) { | 388 void RecordExeMainEntryPointTime(const base::Time& time) { |
369 const std::string exe_load_ticks = | 389 const std::string exe_load_ticks = |
370 base::Int64ToString(StartupTimeToTimeTicks(time).ToInternalValue()); | 390 base::Int64ToString(StartupTimeToTimeTicks(time).ToInternalValue()); |
371 scoped_ptr<base::Environment> env(base::Environment::Create()); | 391 scoped_ptr<base::Environment> env(base::Environment::Create()); |
372 env->SetVar(kChromeMainTicksEnvVar, exe_load_ticks); | 392 env->SetVar(kChromeMainTicksEnvVar, exe_load_ticks); |
373 } | 393 } |
374 | 394 |
375 void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks, | 395 void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks, |
(...skipping 17 matching lines...) Expand all Loading... |
393 // The Startup.BrowserMessageLoopStartTime histogram exhibits instability in | 413 // The Startup.BrowserMessageLoopStartTime histogram exhibits instability in |
394 // the field which limits its usefulness in all scenarios except when we have | 414 // the field which limits its usefulness in all scenarios except when we have |
395 // a very large sample size. Attempt to mitigate this with a new metric: | 415 // a very large sample size. Attempt to mitigate this with a new metric: |
396 // * Measure time from main entry rather than the OS' notion of process start. | 416 // * Measure time from main entry rather than the OS' notion of process start. |
397 // * Only measure launches that occur 7 minutes after boot to try to avoid | 417 // * Only measure launches that occur 7 minutes after boot to try to avoid |
398 // cases where Chrome is auto-started and IO is heavily loaded. | 418 // cases where Chrome is auto-started and IO is heavily loaded. |
399 if (is_first_run) { | 419 if (is_first_run) { |
400 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 420 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
401 UMA_HISTOGRAM_LONG_TIMES, | 421 UMA_HISTOGRAM_LONG_TIMES, |
402 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun", | 422 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun", |
403 g_main_entry_point_ticks.Get(), ticks); | 423 g_browser_main_entry_point_ticks.Get(), ticks); |
404 } else { | 424 } else { |
405 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 425 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
406 UMA_HISTOGRAM_LONG_TIMES, | 426 UMA_HISTOGRAM_LONG_TIMES, |
407 "Startup.BrowserMessageLoopStartTimeFromMainEntry", | 427 "Startup.BrowserMessageLoopStartTimeFromMainEntry", |
408 g_main_entry_point_ticks.Get(), ticks); | 428 g_browser_main_entry_point_ticks.Get(), ticks); |
409 } | 429 } |
410 | 430 |
411 // Record timings between process creation, the main() in the executable being | 431 // Record timings between process creation, the main() in the executable being |
412 // reached and the main() in the shared library being reached. | 432 // reached and the main() in the shared library being reached. |
413 if (!process_creation_ticks.is_null()) { | 433 if (!process_creation_ticks.is_null()) { |
414 const base::TimeTicks exe_main_ticks = ExeMainEntryPointTicks(); | 434 const base::TimeTicks exe_main_ticks = ExeMainEntryPointTicks(); |
415 if (!exe_main_ticks.is_null()) { | 435 if (!exe_main_ticks.is_null()) { |
416 // Process create to chrome.exe:main(). | 436 // Process create to chrome.exe:main(). |
417 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 437 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
418 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain", | 438 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain", |
419 process_creation_ticks, exe_main_ticks); | 439 process_creation_ticks, exe_main_ticks); |
420 | 440 |
421 // chrome.exe:main() to chrome.dll:main(). | 441 // chrome.exe:main() to chrome.dll:main(). |
422 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 442 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
423 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain", | 443 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain", |
424 exe_main_ticks, g_main_entry_point_ticks.Get()); | 444 exe_main_ticks, g_browser_main_entry_point_ticks.Get()); |
425 | 445 |
426 // Process create to chrome.dll:main(). Reported as a histogram only as | 446 // Process create to chrome.dll:main(). Reported as a histogram only as |
427 // the other two events above are sufficient for tracing purposes. | 447 // the other two events above are sufficient for tracing purposes. |
428 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE( | 448 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE( |
429 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain", | 449 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain", |
430 g_main_entry_point_ticks.Get() - process_creation_ticks); | 450 g_browser_main_entry_point_ticks.Get() - process_creation_ticks); |
431 } | 451 } |
432 } | 452 } |
433 } | 453 } |
434 | 454 |
435 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { | 455 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { |
436 static bool is_first_call = true; | 456 static bool is_first_call = true; |
437 if (!is_first_call || ticks.is_null()) | 457 if (!is_first_call || ticks.is_null()) |
438 return; | 458 return; |
439 is_first_call = false; | 459 is_first_call = false; |
440 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) | 460 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) |
441 return; | 461 return; |
442 | 462 |
443 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 463 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
444 UMA_HISTOGRAM_LONG_TIMES, "Startup.BrowserWindowDisplay", | 464 UMA_HISTOGRAM_LONG_TIMES, "Startup.BrowserWindowDisplay", |
445 g_process_creation_ticks.Get(), ticks); | 465 g_process_creation_ticks.Get(), ticks); |
446 } | 466 } |
447 | 467 |
448 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta) { | 468 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta) { |
449 static bool is_first_call = true; | 469 static bool is_first_call = true; |
450 if (!is_first_call) | 470 if (!is_first_call) |
451 return; | 471 return; |
452 is_first_call = false; | 472 is_first_call = false; |
453 | 473 |
454 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(UMA_HISTOGRAM_LONG_TIMES_100, | 474 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE(UMA_HISTOGRAM_LONG_TIMES_100, |
455 "Startup.BrowserOpenTabs", delta); | 475 "Startup.BrowserOpenTabs", delta); |
456 } | 476 } |
457 | 477 |
| 478 void RecordRendererMainEntryTime(const base::TimeTicks& ticks) { |
| 479 // Record the renderer main entry time, but don't log the UMA metric |
| 480 // immediately because the startup temperature is not known yet. |
| 481 if (g_renderer_main_entry_point_ticks.Get().is_null()) |
| 482 g_renderer_main_entry_point_ticks.Get() = ticks; |
| 483 } |
| 484 |
458 void RecordFirstWebContentsMainFrameLoad(const base::TimeTicks& ticks) { | 485 void RecordFirstWebContentsMainFrameLoad(const base::TimeTicks& ticks) { |
459 static bool is_first_call = true; | 486 static bool is_first_call = true; |
460 if (!is_first_call || ticks.is_null()) | 487 if (!is_first_call || ticks.is_null()) |
461 return; | 488 return; |
462 is_first_call = false; | 489 is_first_call = false; |
463 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) | 490 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) |
464 return; | 491 return; |
465 | 492 |
466 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 493 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
467 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.MainFrameLoad2", | 494 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.MainFrameLoad2", |
(...skipping 12 matching lines...) Expand all Loading... |
480 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE( | 507 UMA_HISTOGRAM_WITH_STARTUP_TEMPERATURE( |
481 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.MainFrameLoad", | 508 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.MainFrameLoad", |
482 ticks - g_process_creation_ticks.Get()); | 509 ticks - g_process_creation_ticks.Get()); |
483 } | 510 } |
484 | 511 |
485 void RecordFirstWebContentsNonEmptyPaint(const base::TimeTicks& ticks) { | 512 void RecordFirstWebContentsNonEmptyPaint(const base::TimeTicks& ticks) { |
486 static bool is_first_call = true; | 513 static bool is_first_call = true; |
487 if (!is_first_call || ticks.is_null()) | 514 if (!is_first_call || ticks.is_null()) |
488 return; | 515 return; |
489 is_first_call = false; | 516 is_first_call = false; |
| 517 |
| 518 // Log Startup.BrowserMainToRendererMain now that the first renderer main |
| 519 // entry time and the startup temperature are known. |
| 520 RecordRendererMainEntryHistogram(); |
| 521 |
490 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) | 522 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) |
491 return; | 523 return; |
492 | 524 |
493 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 525 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
494 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.NonEmptyPaint2", | 526 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.FirstWebContents.NonEmptyPaint2", |
495 g_process_creation_ticks.Get(), ticks); | 527 g_process_creation_ticks.Get(), ticks); |
496 } | 528 } |
497 | 529 |
498 void RecordDeprecatedFirstWebContentsNonEmptyPaint( | 530 void RecordDeprecatedFirstWebContentsNonEmptyPaint( |
499 const base::TimeTicks& ticks) { | 531 const base::TimeTicks& ticks) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) | 564 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) |
533 return; | 565 return; |
534 | 566 |
535 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( | 567 UMA_HISTOGRAM_AND_TRACE_WITH_STARTUP_TEMPERATURE( |
536 UMA_HISTOGRAM_LONG_TIMES_100, | 568 UMA_HISTOGRAM_LONG_TIMES_100, |
537 "Startup.FirstWebContents.MainNavigationFinished", | 569 "Startup.FirstWebContents.MainNavigationFinished", |
538 g_process_creation_ticks.Get(), ticks); | 570 g_process_creation_ticks.Get(), ticks); |
539 } | 571 } |
540 | 572 |
541 base::TimeTicks MainEntryPointTicks() { | 573 base::TimeTicks MainEntryPointTicks() { |
542 return g_main_entry_point_ticks.Get(); | 574 return g_browser_main_entry_point_ticks.Get(); |
543 } | 575 } |
544 | 576 |
545 StartupTemperature GetStartupTemperature() { | 577 StartupTemperature GetStartupTemperature() { |
546 return g_startup_temperature; | 578 return g_startup_temperature; |
547 } | 579 } |
548 | 580 |
549 } // namespace startup_metric_utils | 581 } // namespace startup_metric_utils |
OLD | NEW |