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 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 RecordMainEntryTimeHistogram(); | 602 RecordMainEntryTimeHistogram(); |
603 | 603 |
604 const base::TimeTicks& process_creation_ticks = | 604 const base::TimeTicks& process_creation_ticks = |
605 g_process_creation_ticks.Get(); | 605 g_process_creation_ticks.Get(); |
606 if (!is_first_run && !process_creation_ticks.is_null()) { | 606 if (!is_first_run && !process_creation_ticks.is_null()) { |
607 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 607 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
608 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMessageLoopStartTime", | 608 UMA_HISTOGRAM_LONG_TIMES_100, "Startup.BrowserMessageLoopStartTime", |
609 process_creation_ticks, ticks); | 609 process_creation_ticks, ticks); |
610 } | 610 } |
611 | 611 |
612 // TODO(fdoray): Remove histograms that are only recorded after 7 minutes of | |
613 // OS uptime once M54 hits stable. These histograms are kept for now to allow | |
614 // regressions to be caught reliably in M54, to be removed in M55. | |
615 // crbug.com/634408 | |
616 const bool is_seven_minutes_after_boot = | |
617 base::SysInfo::Uptime() < base::TimeDelta::FromMinutes(7); | |
618 | |
619 // Record timing between the shared library's main() entry and the browser | 612 // Record timing between the shared library's main() entry and the browser |
620 // main message loop start. | 613 // main message loop start. |
621 if (is_first_run) { | 614 if (is_first_run) { |
622 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE( | 615 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE( |
623 UMA_HISTOGRAM_LONG_TIMES, | 616 UMA_HISTOGRAM_LONG_TIMES, |
624 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun2", | 617 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun2", |
625 g_browser_main_entry_point_ticks.Get(), ticks); | 618 g_browser_main_entry_point_ticks.Get(), ticks); |
626 if (is_seven_minutes_after_boot) { | |
627 UMA_HISTOGRAM_WITH_TEMPERATURE( | |
628 UMA_HISTOGRAM_LONG_TIMES, | |
629 "Startup.BrowserMessageLoopStartTimeFromMainEntry.FirstRun", | |
630 ticks - g_browser_main_entry_point_ticks.Get()); | |
631 } | |
632 } else { | 619 } else { |
633 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 620 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
634 UMA_HISTOGRAM_LONG_TIMES, | 621 UMA_HISTOGRAM_LONG_TIMES, |
635 "Startup.BrowserMessageLoopStartTimeFromMainEntry2", | 622 "Startup.BrowserMessageLoopStartTimeFromMainEntry2", |
636 g_browser_main_entry_point_ticks.Get(), ticks); | 623 g_browser_main_entry_point_ticks.Get(), ticks); |
637 if (is_seven_minutes_after_boot) { | |
638 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
639 UMA_HISTOGRAM_LONG_TIMES, | |
640 "Startup.BrowserMessageLoopStartTimeFromMainEntry", | |
641 ticks - g_browser_main_entry_point_ticks.Get()); | |
642 } | |
643 } | 624 } |
644 | 625 |
645 // Record timings between process creation, the main() in the executable being | 626 // Record timings between process creation, the main() in the executable being |
646 // reached and the main() in the shared library being reached. | 627 // reached and the main() in the shared library being reached. |
647 if (!process_creation_ticks.is_null() && | 628 if (!process_creation_ticks.is_null() && |
648 !g_browser_exe_main_entry_point_ticks.Get().is_null()) { | 629 !g_browser_exe_main_entry_point_ticks.Get().is_null()) { |
649 const base::TimeTicks exe_main_ticks = | 630 const base::TimeTicks exe_main_ticks = |
650 g_browser_exe_main_entry_point_ticks.Get(); | 631 g_browser_exe_main_entry_point_ticks.Get(); |
651 const base::TimeTicks main_entry_ticks = | 632 const base::TimeTicks main_entry_ticks = |
652 g_browser_main_entry_point_ticks.Get(); | 633 g_browser_main_entry_point_ticks.Get(); |
653 // Process create to chrome.exe:main(). | 634 // Process create to chrome.exe:main(). |
654 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 635 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
655 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain2", | 636 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain2", |
656 process_creation_ticks, exe_main_ticks); | 637 process_creation_ticks, exe_main_ticks); |
657 | 638 |
658 // chrome.exe:main() to chrome.dll:main(). | 639 // chrome.exe:main() to chrome.dll:main(). |
659 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 640 UMA_HISTOGRAM_AND_TRACE_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
660 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain2", | 641 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain2", |
661 exe_main_ticks, main_entry_ticks); | 642 exe_main_ticks, main_entry_ticks); |
662 | 643 |
663 // Process create to chrome.dll:main(). Reported as a histogram only as | 644 // Process create to chrome.dll:main(). Reported as a histogram only as |
664 // the other two events above are sufficient for tracing purposes. | 645 // the other two events above are sufficient for tracing purposes. |
665 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | 646 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( |
666 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain2", | 647 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain2", |
667 main_entry_ticks - process_creation_ticks); | 648 main_entry_ticks - process_creation_ticks); |
668 | |
669 if (is_seven_minutes_after_boot) { | |
670 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
671 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToExeMain", | |
672 exe_main_ticks - process_creation_ticks); | |
673 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
674 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ExeMainToDllMain", | |
675 main_entry_ticks - exe_main_ticks); | |
676 UMA_HISTOGRAM_WITH_TEMPERATURE_AND_SAME_VERSION_COUNT( | |
677 UMA_HISTOGRAM_LONG_TIMES, "Startup.LoadTime.ProcessCreateToDllMain", | |
678 main_entry_ticks - process_creation_ticks); | |
679 } | |
680 } | 649 } |
681 } | 650 } |
682 | 651 |
683 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { | 652 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks) { |
684 static bool is_first_call = true; | 653 static bool is_first_call = true; |
685 if (!is_first_call || ticks.is_null()) | 654 if (!is_first_call || ticks.is_null()) |
686 return; | 655 return; |
687 is_first_call = false; | 656 is_first_call = false; |
688 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) | 657 if (WasNonBrowserUIDisplayed() || g_process_creation_ticks.Get().is_null()) |
689 return; | 658 return; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 UMA_HISTOGRAM_LONG_TIMES_100, | 737 UMA_HISTOGRAM_LONG_TIMES_100, |
769 "Startup.FirstWebContents.MainNavigationFinished", | 738 "Startup.FirstWebContents.MainNavigationFinished", |
770 g_process_creation_ticks.Get(), ticks); | 739 g_process_creation_ticks.Get(), ticks); |
771 } | 740 } |
772 | 741 |
773 base::TimeTicks MainEntryPointTicks() { | 742 base::TimeTicks MainEntryPointTicks() { |
774 return g_browser_main_entry_point_ticks.Get(); | 743 return g_browser_main_entry_point_ticks.Get(); |
775 } | 744 } |
776 | 745 |
777 } // namespace startup_metric_utils | 746 } // namespace startup_metric_utils |
OLD | NEW |