| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 RecordMainEntryTimeHistogram(); | 601 RecordMainEntryTimeHistogram(); |
| 602 | 602 |
| 603 const base::TimeTicks& process_creation_ticks = | 603 const base::TimeTicks& process_creation_ticks = |
| 604 g_process_creation_ticks.Get(); | 604 g_process_creation_ticks.Get(); |
| 605 if (!is_first_run && !process_creation_ticks.is_null()) { | 605 if (!is_first_run && !process_creation_ticks.is_null()) { |
| 606 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 606 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 607 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMessageLoopStartTime", | 607 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMessageLoopStartTime", |
| 608 process_creation_ticks, ticks); | 608 process_creation_ticks, ticks); |
| 609 } | 609 } |
| 610 | 610 |
| 611 // Bail if uptime < 7 minutes, to filter out cases where Chrome may have been | 611 // TODO(fdoray): Remove histograms that are only recorded after 7 minutes of |
| 612 // autostarted and the machine is under io pressure. | 612 // OS uptime once M54 hits stable. These histograms are kept for now to allow |
| 613 if (base::SysInfo::Uptime() < base::TimeDelta::FromMinutes(7)) | 613 // regressions to be caught reliably in M54, to be removed in M55. |
| 614 return; | 614 // crbug.com/634408 |
| 615 const bool is_seven_minutes_after_boot = |
| 616 base::SysInfo::Uptime() < base::TimeDelta::FromMinutes(7); |
| 615 | 617 |
| 616 // The Startup.BrowserMessageLoopStartTime histogram exhibits instability in | 618 // Record timing between the shared library's main() entry and the browser |
| 617 // the field which limits its usefulness in all scenarios except when we have | 619 // main message loop start. |
| 618 // a very large sample size. Attempt to mitigate this with a new metric: | |
| 619 // * Measure time from main entry rather than the OS' notion of process start. | |
| 620 // * Only measure launches that occur 7 minutes after boot to try to avoid | |
| 621 // cases where Chrome is auto-started and IO is heavily loaded. | |
| 622 if (is_first_run) { | 620 if (is_first_run) { |
| 623 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE( | 621 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE( |
| 624 UMA_HISTOGRAM_LONG_TIMES, | 622 UMA_HISTOGRAM_LONG_TIMES, |
| 625 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun", | 623 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun2", |
| 626 g_browser_main_entry_point_ticks.Get(), ticks); | 624 g_browser_main_entry_point_ticks.Get(), ticks); |
| 625 if (is_seven_minutes_after_boot) { |
| 626 UMA_HISTOGRAM_WITH_TEMPERATURE( |
| 627 UMA_HISTOGRAM_LONG_TIMES, |
| 628 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun", |
| 629 ticks - g_browser_main_entry_point_ticks.Get()); |
| 630 } |
| 627 } else { | 631 } else { |
| 628 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 632 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 629 UMA_HISTOGRAM_LONG_TIMES, | 633 UMA_HISTOGRAM_LONG_TIMES, |
| 630 "Startup.BrowserMessageLoopStartTimeFromMainEntry", | 634 "Startup.BrowserMessageLoopStartTimeFromMainEntry2", |
| 631 g_browser_main_entry_point_ticks.Get(), ticks); | 635 g_browser_main_entry_point_ticks.Get(), ticks); |
| 636 if (is_seven_minutes_after_boot) { |
| 637 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 638 UMA_HISTOGRAM_LONG_TIMES, |
| 639 "Startup.BrowserMessageLoopStartTimeFromMainEntry", |
| 640 ticks - g_browser_main_entry_point_ticks.Get()); |
| 641 } |
| 632 } | 642 } |
| 633 | 643 |
| 634 // Record timings between process creation, the main() in the executable being | 644 // Record timings between process creation, the main() in the executable being |
| 635 // reached and the main() in the shared library being reached. | 645 // reached and the main() in the shared library being reached. |
| 636 if (!process_creation_ticks.is_null()) { | 646 if (!process_creation_ticks.is_null()) { |
| 637 const base::TimeTicks exe_main_ticks = ExeMainEntryPointTicks(); | 647 const base::TimeTicks exe_main_ticks = ExeMainEntryPointTicks(); |
| 638 if (!exe_main_ticks.is_null()) { | 648 if (!exe_main_ticks.is_null()) { |
| 639 // Process create to chrome.exe:main(). | 649 // Process create to chrome.exe:main(). |
| 640 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 650 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 641 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain", | 651 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain2", |
| 642 process_creation_ticks, exe_main_ticks); | 652 process_creation_ticks, exe_main_ticks); |
| 643 | 653 |
| 644 // chrome.exe:main() to chrome.dll:main(). | 654 // chrome.exe:main() to chrome.dll:main(). |
| 645 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 655 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 646 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain", | 656 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain2", |
| 647 exe_main_ticks, g_browser_main_entry_point_ticks.Get()); | 657 exe_main_ticks, g_browser_main_entry_point_ticks.Get()); |
| 648 | 658 |
| 649 // Process create to chrome.dll:main(). Reported as a histogram only as | 659 // Process create to chrome.dll:main(). Reported as a histogram only as |
| 650 // the other two events above are sufficient for tracing purposes. | 660 // the other two events above are sufficient for tracing purposes. |
| 651 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 661 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 652 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain", | 662 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain2", |
| 653 g_browser_main_entry_point_ticks.Get() - process_creation_ticks); | 663 g_browser_main_entry_point_ticks.Get() - process_creation_ticks); |
| 664 |
| 665 if (is_seven_minutes_after_boot) { |
| 666 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 667 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain", |
| 668 exe_main_ticks - process_creation_ticks); |
| 669 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 670 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain", |
| 671 g_browser_main_entry_point_ticks.Get() - exe_main_ticks); |
| 672 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 673 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain", |
| 674 g_browser_main_entry_point_ticks.Get() - process_creation_ticks); |
| 675 } |
| 654 } | 676 } |
| 655 } | 677 } |
| 656 } | 678 } |
| 657 | 679 |
| 658 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { | 680 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { |
| 659 static bool is_first_call = true; | 681 static bool is_first_call = true; |
| 660 if (!is_first_call || ticks.is_null()) | 682 if (!is_first_call || ticks.is_null()) |
| 661 return; | 683 return; |
| 662 is_first_call = false; | 684 is_first_call = false; |
| 663 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) | 685 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 769 |
| 748 base::TimeTicks MainEntryPointTicks() { | 770 base::TimeTicks MainEntryPointTicks() { |
| 749 return g_browser_main_entry_point_ticks.Get(); | 771 return g_browser_main_entry_point_ticks.Get(); |
| 750 } | 772 } |
| 751 | 773 |
| 752 StartupTemperature GetStartupTemperature() { | 774 StartupTemperature GetStartupTemperature() { |
| 753 return g_startup_temperature; | 775 return g_startup_temperature; |
| 754 } | 776 } |
| 755 | 777 |
| 756 } // namespace startup_metric_utils | 778 } // namespace startup_metric_utils |
| OLD | NEW |