| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_COMMON_STARTUP_METRIC_UTILS_H_ | 5 #ifndef CHROME_COMMON_STARTUP_METRIC_UTILS_H_ |
| 6 #define CHROME_COMMON_STARTUP_METRIC_UTILS_H_ | 6 #define CHROME_COMMON_STARTUP_METRIC_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // UI invocation regardless of whether the browser window has already | 26 // UI invocation regardless of whether the browser window has already |
| 27 // been displayed or not. | 27 // been displayed or not. |
| 28 void SetNonBrowserUIDisplayed(); | 28 void SetNonBrowserUIDisplayed(); |
| 29 | 29 |
| 30 // Call this as early as possible in the startup process to record a | 30 // Call this as early as possible in the startup process to record a |
| 31 // timestamp. | 31 // timestamp. |
| 32 void RecordMainEntryPointTime(); | 32 void RecordMainEntryPointTime(); |
| 33 | 33 |
| 34 // Called just before the message loop is about to start. Entry point to record | 34 // Called just before the message loop is about to start. Entry point to record |
| 35 // startup stats. | 35 // startup stats. |
| 36 void OnBrowserStartupComplete(); | 36 // |is_first_run| - is the current launch part of a first run. |
| 37 void OnBrowserStartupComplete(bool is_first_run); |
| 37 | 38 |
| 38 // Called when the initial page load has finished in order to record startup | 39 // Called when the initial page load has finished in order to record startup |
| 39 // stats. | 40 // stats. |
| 40 void OnInitialPageLoadComplete(); | 41 void OnInitialPageLoadComplete(); |
| 41 | 42 |
| 42 // Scoper that records the time period before it's destructed in a histogram | 43 // Scoper that records the time period before it's destructed in a histogram |
| 43 // with the given name. The histogram is only recorded for slow chrome startups. | 44 // with the given name. The histogram is only recorded for slow chrome startups. |
| 44 // Useful for trying to figure out what parts of Chrome cause slow startup. | 45 // Useful for trying to figure out what parts of Chrome cause slow startup. |
| 45 class ScopedSlowStartupUMA { | 46 class ScopedSlowStartupUMA { |
| 46 public: | 47 public: |
| 47 explicit ScopedSlowStartupUMA(const std::string& histogram_name) | 48 explicit ScopedSlowStartupUMA(const std::string& histogram_name) |
| 48 : start_time_(base::TimeTicks::Now()), | 49 : start_time_(base::TimeTicks::Now()), |
| 49 histogram_name_(histogram_name) {} | 50 histogram_name_(histogram_name) {} |
| 50 | 51 |
| 51 ~ScopedSlowStartupUMA(); | 52 ~ScopedSlowStartupUMA(); |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 const base::TimeTicks start_time_; | 55 const base::TimeTicks start_time_; |
| 55 const std::string histogram_name_; | 56 const std::string histogram_name_; |
| 56 | 57 |
| 57 DISALLOW_COPY_AND_ASSIGN(ScopedSlowStartupUMA); | 58 DISALLOW_COPY_AND_ASSIGN(ScopedSlowStartupUMA); |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 } // namespace startup_metric_utils | 61 } // namespace startup_metric_utils |
| 61 | 62 |
| 62 #endif // CHROME_COMMON_STARTUP_METRIC_UTILS_H_ | 63 #endif // CHROME_COMMON_STARTUP_METRIC_UTILS_H_ |
| OLD | NEW |