Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: components/startup_metric_utils/browser/startup_metric_utils.h

Issue 1425263003: Use TimeTicks as much as possible in startup_metric_utils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_BROWSER_STARTUP_METRIC_UTILS_H_ 5 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_
6 #define COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ 6 #define COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_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"
11 11
12 // Utility functions to support metric collection for browser startup. 12 // Utility functions to support metric collection for browser startup. Timings
13 // should use TimeTicks as much as possible. OS-provided timings are still
14 // received as Time but are converted to TimeTicks as soon as possible as well
fdoray 2015/11/09 21:27:16 The "as well" sounds weird to me. But I trust you
gab 2015/11/10 01:25:29 Agreed, re-worded entire comment.
15 // (while the likelihood of a skew between the two basis is as low as possible).
16 // See crbug.com/544131 for reasoning.
13 17
14 namespace startup_metric_utils { 18 namespace startup_metric_utils {
15 19
16 // An enumeration of startup temperatures. This must be kept in sync with the 20 // An enumeration of startup temperatures. This must be kept in sync with the
17 // UMA StartupType enumeration defined in histograms.xml. 21 // UMA StartupType enumeration defined in histograms.xml.
18 enum StartupTemperature { 22 enum StartupTemperature {
19 // The startup was a cold start: nearly all of the Chrome binaries and 23 // The startup was a cold start: nearly all of the Chrome binaries and
20 // resources were brought into memory using hard faults. 24 // resources were brought into memory using hard faults.
21 COLD_STARTUP_TEMPERATURE = 0, 25 COLD_STARTUP_TEMPERATURE = 0,
22 // The startup was a warm start: the Chrome binaries and resources were 26 // The startup was a warm start: the Chrome binaries and resources were
(...skipping 29 matching lines...) Expand all
52 // In Mojo, the entry point time is the time at which the shell starts. 56 // In Mojo, the entry point time is the time at which the shell starts.
53 void RecordMainEntryPointTime(const base::Time& time); 57 void RecordMainEntryPointTime(const base::Time& time);
54 58
55 // Call this with the time when the executable is loaded and main() is entered. 59 // Call this with the time when the executable is loaded and main() is entered.
56 // Can be different from |RecordMainEntryPointTime| when the startup process is 60 // Can be different from |RecordMainEntryPointTime| when the startup process is
57 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows. 61 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows.
58 void RecordExeMainEntryPointTime(const base::Time& time); 62 void RecordExeMainEntryPointTime(const base::Time& time);
59 63
60 // Call this with the time recorded just before the message loop is started. 64 // Call this with the time recorded just before the message loop is started.
61 // |is_first_run| - is the current launch part of a first run. 65 // |is_first_run| - is the current launch part of a first run.
62 void RecordBrowserMainMessageLoopStart(const base::Time& time, 66 void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks,
63 bool is_first_run); 67 bool is_first_run);
64 68
65 // Call this with the time when the first browser window became visible. 69 // Call this with the time when the first browser window became visible.
66 void RecordBrowserWindowDisplay(const base::Time& time); 70 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks);
67 71
68 // Call this with the time delta that the browser spent opening its tabs. 72 // Call this with the time delta that the browser spent opening its tabs.
69 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta); 73 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta);
70 74
71 // Call this with the time when the first web contents loaded its main frame, 75 // Call this with the time when the first web contents loaded its main frame,
72 // only if the first web contents was unimpended in its attempt to do so. 76 // only if the first web contents was unimpended in its attempt to do so.
73 void RecordFirstWebContentsMainFrameLoad(const base::Time& time); 77 void RecordFirstWebContentsMainFrameLoad(const base::TimeTicks& ticks);
74 78
75 // Call this with the time when the first web contents loaded its main frame. 79 // Call this with the time when the first web contents loaded its main frame.
76 // This records an old stat kept for comparison purposes until M49. 80 // This records an old stat kept for comparison purposes until M49.
77 void RecordDeprecatedFirstWebContentsMainFrameLoad(const base::Time& time); 81 void RecordDeprecatedFirstWebContentsMainFrameLoad(
82 const base::TimeTicks& ticks);
78 83
79 // Call this with the time when the first web contents had a non-empty paint, 84 // Call this with the time when the first web contents had a non-empty paint,
80 // only if the first web contents was unimpended in its attempt to do so. 85 // only if the first web contents was unimpended in its attempt to do so.
81 void RecordFirstWebContentsNonEmptyPaint(const base::Time& time); 86 void RecordFirstWebContentsNonEmptyPaint(const base::TimeTicks& ticks);
82 87
83 // Call this with the time when the first web contents had a non-empty paint. 88 // Call this with the time when the first web contents had a non-empty paint.
84 // This records an old stat kept for comparison purposes until M49. 89 // This records an old stat kept for comparison purposes until M49.
85 void RecordDeprecatedFirstWebContentsNonEmptyPaint(const base::Time& time); 90 void RecordDeprecatedFirstWebContentsNonEmptyPaint(
91 const base::TimeTicks& ticks);
86 92
87 // Call this with the time when the first web contents began navigating its main 93 // Call this with the time when the first web contents began navigating its main
88 // frame. 94 // frame.
89 void RecordFirstWebContentsMainNavigationStart(const base::Time& time); 95 void RecordFirstWebContentsMainNavigationStart(const base::TimeTicks& ticks);
90 96
91 // Call this with the time when the first web contents successfully committed 97 // Call this with the time when the first web contents successfully committed
92 // its navigation for the main frame. 98 // its navigation for the main frame.
93 void RecordFirstWebContentsMainNavigationFinished(const base::Time& time); 99 void RecordFirstWebContentsMainNavigationFinished(const base::TimeTicks& ticks);
94 100
95 // Returns the startup type. This is only currently supported on the Windows 101 // Returns the startup type. This is only currently supported on the Windows
96 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms. 102 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms.
97 // This is only valid after a call to RecordBrowserMainMessageLoopStart(). 103 // This is only valid after a call to RecordBrowserMainMessageLoopStart().
98 StartupTemperature GetStartupTemperature(); 104 StartupTemperature GetStartupTemperature();
99 105
100 } // namespace startup_metric_utils 106 } // namespace startup_metric_utils
101 107
102 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ 108 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698