Chromium Code Reviews| 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. crbug.com/634408 |
|
gab
2016/08/10 16:45:35
s/reliably/reliably in M54, to be removed in M55/
fdoray
2016/08/23 14:50:16
Done.
| |
| 614 return; | 614 const bool is_seven_minutes_after_boot = |
| 615 base::SysInfo::Uptime() < base::TimeDelta::FromMinutes(7); | |
| 615 | 616 |
| 616 // The Startup.BrowserMessageLoopStartTime histogram exhibits instability in | 617 // 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 | 618 // 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) { | 619 if (is_first_run) { |
| 623 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE( | 620 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE( |
| 624 UMA_HISTOGRAM_LONG_TIMES, | 621 UMA_HISTOGRAM_LONG_TIMES, |
| 625 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun", | 622 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun2", |
| 626 g_browser_main_entry_point_ticks.Get(), ticks); | 623 g_browser_main_entry_point_ticks.Get(), ticks); |
| 624 if (is_seven_minutes_after_boot) { | |
| 625 UMA_HISTOGRAM_WITH_TEMPERATURE( | |
| 626 UMA_HISTOGRAM_LONG_TIMES, | |
| 627 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun", | |
| 628 ticks - g_browser_main_entry_point_ticks.Get()); | |
| 629 } | |
| 627 } else { | 630 } else { |
| 628 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 631 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 629 UMA_HISTOGRAM_LONG_TIMES, | 632 UMA_HISTOGRAM_LONG_TIMES, |
| 630 "Startup.BrowserMessageLoopStartTimeFromMainEntry", | 633 "Startup.BrowserMessageLoopStartTimeFromMainEntry2", |
| 631 g_browser_main_entry_point_ticks.Get(), ticks); | 634 g_browser_main_entry_point_ticks.Get(), ticks); |
| 635 if (is_seven_minutes_after_boot) { | |
| 636 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
| 637 UMA_HISTOGRAM_LONG_TIMES, | |
| 638 "Startup.BrowserMessageLoopStartTimeFromMainEntry", | |
| 639 ticks - g_browser_main_entry_point_ticks.Get()); | |
| 640 } | |
| 632 } | 641 } |
| 633 | 642 |
| 634 // Record timings between process creation, the main() in the executable being | 643 // Record timings between process creation, the main() in the executable being |
| 635 // reached and the main() in the shared library being reached. | 644 // reached and the main() in the shared library being reached. |
| 636 if (!process_creation_ticks.is_null()) { | 645 if (!process_creation_ticks.is_null()) { |
| 637 const base::TimeTicks exe_main_ticks = ExeMainEntryPointTicks(); | 646 const base::TimeTicks exe_main_ticks = ExeMainEntryPointTicks(); |
| 638 if (!exe_main_ticks.is_null()) { | 647 if (!exe_main_ticks.is_null()) { |
| 639 // Process create to chrome.exe:main(). | 648 // Process create to chrome.exe:main(). |
| 640 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 649 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 641 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain", | 650 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain2", |
| 642 process_creation_ticks, exe_main_ticks); | 651 process_creation_ticks, exe_main_ticks); |
| 643 | 652 |
| 644 // chrome.exe:main() to chrome.dll:main(). | 653 // chrome.exe:main() to chrome.dll:main(). |
| 645 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 654 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 646 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain", | 655 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain2", |
| 647 exe_main_ticks, g_browser_main_entry_point_ticks.Get()); | 656 exe_main_ticks, g_browser_main_entry_point_ticks.Get()); |
| 648 | 657 |
| 649 // Process create to chrome.dll:main(). Reported as a histogram only as | 658 // Process create to chrome.dll:main(). Reported as a histogram only as |
| 650 // the other two events above are sufficient for tracing purposes. | 659 // the other two events above are sufficient for tracing purposes. |
| 651 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 660 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
| 652 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain", | 661 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain2", |
| 653 g_browser_main_entry_point_ticks.Get() - process_creation_ticks); | 662 g_browser_main_entry_point_ticks.Get() - process_creation_ticks); |
| 663 | |
| 664 if (is_seven_minutes_after_boot) { | |
| 665 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
| 666 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain", | |
| 667 exe_main_ticks - process_creation_ticks); | |
| 668 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
| 669 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain", | |
| 670 g_browser_main_entry_point_ticks.Get() - exe_main_ticks); | |
| 671 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
| 672 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain", | |
| 673 g_browser_main_entry_point_ticks.Get() - process_creation_ticks); | |
| 674 } | |
| 654 } | 675 } |
| 655 } | 676 } |
| 656 } | 677 } |
| 657 | 678 |
| 658 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { | 679 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { |
| 659 static bool is_first_call = true; | 680 static bool is_first_call = true; |
| 660 if (!is_first_call || ticks.is_null()) | 681 if (!is_first_call || ticks.is_null()) |
| 661 return; | 682 return; |
| 662 is_first_call = false; | 683 is_first_call = false; |
| 663 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) | 684 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 747 | 768 |
| 748 base::TimeTicks MainEntryPointTicks() { | 769 base::TimeTicks MainEntryPointTicks() { |
| 749 return g_browser_main_entry_point_ticks.Get(); | 770 return g_browser_main_entry_point_ticks.Get(); |
| 750 } | 771 } |
| 751 | 772 |
| 752 StartupTemperature GetStartupTemperature() { | 773 StartupTemperature GetStartupTemperature() { |
| 753 return g_startup_temperature; | 774 return g_startup_temperature; |
| 754 } | 775 } |
| 755 | 776 |
| 756 } // namespace startup_metric_utils | 777 } // namespace startup_metric_utils |
| OLD | NEW |