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

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: back to _COUNT instead of _MAX 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. All new values should be added
38 // above this one.
38 STARTUP_TEMPERATURE_COUNT, 39 STARTUP_TEMPERATURE_COUNT,
39 // Startup temperature wasn't yet determined. 40 // Startup temperature wasn't yet determined.
40 UNDETERMINED_STARTUP_TEMPERATURE 41 UNDETERMINED_STARTUP_TEMPERATURE
41 }; 42 };
42 43
43 #if defined(OS_WIN) 44 #if defined(OS_WIN)
44 // Gets the hard fault count of the current process through |hard_fault_count|. 45 // Gets the hard fault count of the current process through |hard_fault_count|.
45 // Returns true on success. 46 // Returns true on success.
46 bool GetHardFaultCountForCurrentProcess(uint32_t* hard_fault_count); 47 bool GetHardFaultCountForCurrentProcess(uint32_t* hard_fault_count);
47 #endif // defined(OS_WIN) 48 #endif // defined(OS_WIN)
(...skipping 21 matching lines...) Expand all
69 // On Android, the entry point time is the time at which the Java code starts. 70 // 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. 71 // In Mojo, the entry point time is the time at which the shell starts.
71 void RecordMainEntryPointTime(const base::Time& time); 72 void RecordMainEntryPointTime(const base::Time& time);
72 73
73 // Call this with the time when the executable is loaded and main() is entered. 74 // 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 75 // 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. 76 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows.
76 void RecordExeMainEntryPointTime(const base::Time& time); 77 void RecordExeMainEntryPointTime(const base::Time& time);
77 78
78 // Call this with the time recorded just before the message loop is started. 79 // 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. 80 // |is_first_run| - is the current launch part of a first run. |pref_service| is
81 // an optional parameter which, if provided, will be used to store state for
82 // stats that span multiple startups; in its absence those stats will not be
83 // recorded.
80 void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks, 84 void RecordBrowserMainMessageLoopStart(const base::TimeTicks& ticks,
81 bool is_first_run); 85 bool is_first_run,
82 86 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 87
95 // Call this with the time when the first browser window became visible. 88 // Call this with the time when the first browser window became visible.
96 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks); 89 void RecordBrowserWindowDisplay(const base::TimeTicks& ticks);
97 90
98 // Call this with the time delta that the browser spent opening its tabs. 91 // Call this with the time delta that the browser spent opening its tabs.
99 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta); 92 void RecordBrowserOpenTabsDelta(const base::TimeDelta& delta);
100 93
101 // Call this with a renderer main entry time. The value provided for the first 94 // Call this with a renderer main entry time. The value provided for the first
102 // call to this function is used to compute 95 // call to this function is used to compute
103 // Startup.LoadTime.BrowserMainToRendererMain. Further calls to this 96 // Startup.LoadTime.BrowserMainToRendererMain. Further calls to this
(...skipping 22 matching lines...) Expand all
126 base::TimeTicks MainEntryPointTicks(); 119 base::TimeTicks MainEntryPointTicks();
127 120
128 // Returns the startup type. This is only currently supported on the Windows 121 // Returns the startup type. This is only currently supported on the Windows
129 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms. 122 // platform and will simply return UNCERTAIN_STARTUP_TYPE on other platforms.
130 // This is only valid after a call to RecordBrowserMainMessageLoopStart(). 123 // This is only valid after a call to RecordBrowserMainMessageLoopStart().
131 StartupTemperature GetStartupTemperature(); 124 StartupTemperature GetStartupTemperature();
132 125
133 } // namespace startup_metric_utils 126 } // namespace startup_metric_utils
134 127
135 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_ 128 #endif // COMPONENTS_STARTUP_METRIC_UTILS_BROWSER_STARTUP_METRIC_UTILS_H_
OLDNEW
« no previous file with comments | « components/html_viewer/stats_collection_controller.cc ('k') | components/startup_metric_utils/browser/startup_metric_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698