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

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

Issue 1637493002: Add SameVersionStartupCounts suffix to startup HardFault and Temperature histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b1_startup_count_metric
Patch Set: merge up to r371436 Created 4 years, 11 months 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 <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 16 matching lines...) Expand all
27 enum StartupTemperature { 27 enum StartupTemperature {
28 // The startup was a cold start: nearly all of the binaries and resources were 28 // The startup was a cold start: nearly all of the binaries and resources were
29 // brought into memory using hard faults. 29 // brought into memory using hard faults.
30 COLD_STARTUP_TEMPERATURE = 0, 30 COLD_STARTUP_TEMPERATURE = 0,
31 // The startup was a warm start: the binaries and resources were mostly 31 // The startup was a warm start: the binaries and resources were mostly
32 // already resident in memory and effectively no hard faults were observed. 32 // already resident in memory and effectively no hard faults were observed.
33 WARM_STARTUP_TEMPERATURE = 1, 33 WARM_STARTUP_TEMPERATURE = 1,
34 // The startup type couldn't quite be classified as warm or cold, but rather 34 // The startup type couldn't quite be classified as warm or cold, but rather
35 // was somewhere in between. 35 // was somewhere in between.
36 LUKEWARM_STARTUP_TEMPERATURE = 2, 36 LUKEWARM_STARTUP_TEMPERATURE = 2,
37 // This must be after all meaningful values. 37 // This must be after all meaningful values and be equal to the last one.
38 STARTUP_TEMPERATURE_COUNT, 38 STARTUP_TEMPERATURE_MAX = LUKEWARM_STARTUP_TEMPERATURE,
39 // Startup temperature wasn't yet determined. 39 // Startup temperature wasn't yet determined.
40 UNDETERMINED_STARTUP_TEMPERATURE 40 UNDETERMINED_STARTUP_TEMPERATURE
msw 2016/01/26 18:08:30 nit: trailing comma
gab 2016/01/26 18:15:07 This is on purpose, this one should always be last
msw 2016/01/26 18:16:51 Acknowledged.
41 }; 41 };
42 42
43 #if defined(OS_WIN) 43 #if defined(OS_WIN)
44 // Gets the hard fault count of the current process through |hard_fault_count|. 44 // Gets the hard fault count of the current process through |hard_fault_count|.
45 // Returns true on success. 45 // Returns true on success.
46 bool GetHardFaultCountForCurrentProcess(uint32_t* hard_fault_count); 46 bool GetHardFaultCountForCurrentProcess(uint32_t* hard_fault_count);
47 #endif // defined(OS_WIN) 47 #endif // defined(OS_WIN)
48 48
49 // Registers startup related prefs in |registry|. 49 // Registers startup related prefs in |registry|.
50 void RegisterPrefs(PrefRegistrySimple* registry); 50 void RegisterPrefs(PrefRegistrySimple* registry);
(...skipping 18 matching lines...) Expand all
69 // On Android, the entry point time is the time at which the Java code starts. 69 // On Android, the entry point time is the time at which the Java code starts.
70 // In Mojo, the entry point time is the time at which the shell starts. 70 // In Mojo, the entry point time is the time at which the shell starts.
71 void RecordMainEntryPointTime(const base::Time& time); 71 void RecordMainEntryPointTime(const base::Time& time);
72 72
73 // Call this with the time when the executable is loaded and main() is entered. 73 // Call this with the time when the executable is loaded and main() is entered.
74 // Can be different from |RecordMainEntryPointTime| when the startup process is 74 // Can be different from |RecordMainEntryPointTime| when the startup process is
75 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows. 75 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows.
76 void RecordExeMainEntryPointTime(const base::Time& time); 76 void RecordExeMainEntryPointTime(const base::Time& time);
77 77
78 // Call this with the time recorded just before the message loop is started. 78 // Call this with the time recorded just before the message loop is started.
79 // |is_first_run| - is the current launch part of a first run. 79 // |is_first_run| - is the current launch part of a first run. |pref_service| is
80 // an optional parameter which, if provided, will be used to store state for
81 // stats that span multiple startups; in its absence those stats will not be
msw 2016/01/26 18:08:30 nit: maybe describe which stats, like the removed
gab 2016/01/26 18:15:07 This is constantly subject to change so I intentio
msw 2016/01/26 18:16:51 Acknowledged.
82 // recorded.
80 void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks, 83 void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks,
81 bool is_first_run); 84 bool is_first_run,
82 85 PrefService* pref_service);
83 // Logs the Startup.TimeSinceLastStartup histogram. Obtains the timestamp of the
84 // last startup from |pref_service| and overwrites it with the timestamp of the
85 // current startup. If the startup temperature has been set by
86 // RecordBrowserMainMessageLoopStart, the time since last startup is also logged
87 // to an histogram suffixed with the startup temperature.
88 void RecordTimeSinceLastStartup(PrefService* pref_service);
89
90 // Logs the Startup.SameVersionStartupCount histogram. Relies on |pref_service|
91 // to know information about the previous startups and store information for
92 // future ones.
93 void RecordStartupCount(PrefService* pref_service);
94 86
95 // Call this with the time when the first browser window became visible. 87 // Call this with the time when the first browser window became visible.
96 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks); 88 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks);
97 89
98 // Call this with the time delta that the browser spent opening its tabs. 90 // Call this with the time delta that the browser spent opening its tabs.
99 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta); 91 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta);
100 92
101 // Call this with a renderer main entry time. The value provided for the first 93 // Call this with a renderer main entry time. The value provided for the first
102 // call to this function is used to compute 94 // call to this function is used to compute
103 // Startup.LoadTime.BrowserMainToRendererMain. Further calls to this 95 // Startup.LoadTime.BrowserMainToRendererMain. Further calls to this
(...skipping 22 matching lines...) Expand all
126 base::TimeTicks MainEntryPointTicks(); 118 base::TimeTicks MainEntryPointTicks();
127 119
128 // Returns the startup type. This is only currently supported on the Windows 120 // Returns the startup type. This is only currently supported on the Windows
129 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms. 121 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms.
130 // This is only valid after a call to RecordBrowserMainMessageLoopStart(). 122 // This is only valid after a call to RecordBrowserMainMessageLoopStart().
131 StartupTemperature GetStartupTemperature(); 123 StartupTemperature GetStartupTemperature();
132 124
133 } // namespace startup_metric_utils 125 } // namespace startup_metric_utils
134 126
135 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ 127 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698