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 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ | 5 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ |
6 #define COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ | 6 #define COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Called just before the message loop is about to start. Entry point to record | 46 // Called just before the message loop is about to start. Entry point to record |
47 // startup stats. | 47 // startup stats. |
48 // |is_first_run| - is the current launch part of a first run. | 48 // |is_first_run| - is the current launch part of a first run. |
49 void OnBrowserStartupComplete(bool is_first_run); | 49 void OnBrowserStartupComplete(bool is_first_run); |
50 | 50 |
51 // Called when the initial page load has finished in order to record startup | 51 // Called when the initial page load has finished in order to record startup |
52 // stats. | 52 // stats. |
53 void OnInitialPageLoadComplete(); | 53 void OnInitialPageLoadComplete(); |
54 | 54 |
| 55 // Returns the time of main entry recorded from RecordMainEntryPointTime. |
| 56 // Returns NULL if that method has not yet been called. |
| 57 // This method is expected to be called from the UI thread. |
| 58 const base::Time* MainEntryPointTime(); |
| 59 |
55 // Scoper that records the time period before it's destructed in a histogram | 60 // Scoper that records the time period before it's destructed in a histogram |
56 // with the given name. The histogram is only recorded for slow chrome startups. | 61 // with the given name. The histogram is only recorded for slow chrome startups. |
57 // Useful for trying to figure out what parts of Chrome cause slow startup. | 62 // Useful for trying to figure out what parts of Chrome cause slow startup. |
58 class ScopedSlowStartupUMA { | 63 class ScopedSlowStartupUMA { |
59 public: | 64 public: |
60 explicit ScopedSlowStartupUMA(const std::string& histogram_name) | 65 explicit ScopedSlowStartupUMA(const std::string& histogram_name) |
61 : start_time_(base::TimeTicks::Now()), | 66 : start_time_(base::TimeTicks::Now()), |
62 histogram_name_(histogram_name) {} | 67 histogram_name_(histogram_name) {} |
63 | 68 |
64 ~ScopedSlowStartupUMA(); | 69 ~ScopedSlowStartupUMA(); |
65 | 70 |
66 private: | 71 private: |
67 const base::TimeTicks start_time_; | 72 const base::TimeTicks start_time_; |
68 const std::string histogram_name_; | 73 const std::string histogram_name_; |
69 | 74 |
70 DISALLOW_COPY_AND_ASSIGN(ScopedSlowStartupUMA); | 75 DISALLOW_COPY_AND_ASSIGN(ScopedSlowStartupUMA); |
71 }; | 76 }; |
72 | 77 |
73 } // namespace startup_metric_utils | 78 } // namespace startup_metric_utils |
74 | 79 |
75 #endif // COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ | 80 #endif // COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ |
OLD | NEW |