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

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

Issue 1413153010: Move components/startup_metric_utils/* to components/startup_metric_utils/browser/*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_
6 #define COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_
7
8 #include <string>
9
10 #include "base/time/time.h"
11
12 // Utility functions to support metric collection for browser startup.
13
14 namespace startup_metric_utils {
15
16 // An enumeration of startup temperatures. This must be kept in sync with the
17 // UMA StartupType enumeration defined in histograms.xml.
18 enum StartupTemperature {
19 // The startup was a cold start: nearly all of the Chrome binaries and
20 // resources were brought into memory using hard faults.
21 COLD_STARTUP_TEMPERATURE = 0,
22 // The startup was a warm start: the Chrome binaries and resources were
23 // mostly already resident in memory and effectively no hard faults were
24 // observed.
25 WARM_STARTUP_TEMPERATURE = 1,
26 // The startup type couldn't quite be classified as warm of cold, but rather
27 // was somewhere in between.
28 UNCERTAIN_STARTUP_TEMPERATURE = 2,
29 // This must be last.
30 STARTUP_TEMPERATURE_MAX
31 };
32
33 // Returns true if any UI other than the browser window has been displayed
34 // so far. Useful to test if UI has been displayed before the first browser
35 // window was shown, which would invalidate any surrounding timing metrics.
36 bool WasNonBrowserUIDisplayed();
37
38 // Call this when displaying UI that might potentially delay the appearance
39 // of the initial browser window on Chrome startup.
40 //
41 // Note on usage: This function is idempotent and its overhead is low enough
42 // in comparison with UI display that it's OK to call it on every
43 // UI invocation regardless of whether the browser window has already
44 // been displayed or not.
45 void SetNonBrowserUIDisplayed();
46
47 // Call this with the creation time of the startup (initial/main) process.
48 void RecordStartupProcessCreationTime(const base::Time& time);
49
50 // Call this with a time recorded as early as possible in the startup process.
51 // On Android, the entry point time is the time at which the Java code starts.
52 // In Mojo, the entry point time is the time at which the shell starts.
53 void RecordMainEntryPointTime(const base::Time& time);
54
55 // 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
57 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows.
58 void RecordExeMainEntryPointTime(const base::Time& time);
59
60 // 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.
62 void RecordBrowserMainMessageLoopStart(const base::Time& time,
63 bool is_first_run);
64
65 // Call this with the time when the first browser window became visible.
66 void RecordBrowserWindowDisplay(const base::Time& time);
67
68 // Call this with the time delta that the browser spent opening its tabs.
69 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta);
70
71 // 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.
73 void RecordFirstWebContentsMainFrameLoad(const base::Time& time);
74
75 // 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.
77 void RecordDeprecatedFirstWebContentsMainFrameLoad(const base::Time& time);
78
79 // 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.
81 void RecordFirstWebContentsNonEmptyPaint(const base::Time& time);
82
83 // 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.
85 void RecordDeprecatedFirstWebContentsNonEmptyPaint(const base::Time& time);
86
87 // Call this with the time when the first web contents began navigating its main
88 // frame.
89 void RecordFirstWebContentsMainNavigationStart(const base::Time& time);
90
91 // Call this with the time when the first web contents successfully committed
92 // its navigation for the main frame.
93 void RecordFirstWebContentsMainNavigationFinished(const base::Time& time);
94
95 // Returns the time of main entry recorded from RecordMainEntryPointTime.
96 // Returns a null Time if a value has not been recorded yet.
97 // This method is expected to be called from the UI thread.
98 base::Time MainEntryPointTime();
99
100 // Returns the startup type. This is only currently supported on the Windows
101 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms.
102 // This is only valid after a call to RecordBrowserMainMessageLoopStart().
103 StartupTemperature GetStartupTemperature();
104
105 } // namespace startup_metric_utils
106
107 #endif // COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698