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

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

Issue 1278673002: Add stats collection for telemetry startup.warm.blank_page test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build; TODO: Android startup perf testing. Created 5 years, 4 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_STARTUP_METRIC_UTILS_H_ 5 #ifndef COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_
6 #define COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ 6 #define COMPONENTS_STARTUP_METRIC_UTILS_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.
13 13
14 namespace startup_metric_utils { 14 namespace startup_metric_utils {
15 15
16 // Returns true if any UI other than the browser window has been displayed 16 // Returns true if any UI other than the browser window has been displayed
17 // so far. Useful to test if UI has been displayed before the first browser 17 // so far. Useful to test if UI has been displayed before the first browser
18 // window was shown, which would invalidate any surrounding timing metrics. 18 // window was shown, which would invalidate any surrounding timing metrics.
19 bool WasNonBrowserUIDisplayed(); 19 bool WasNonBrowserUIDisplayed();
20 20
21 // Call this when displaying UI that might potentially delay the appearance 21 // Call this when displaying UI that might potentially delay the appearance
22 // of the initial browser window on Chrome startup. 22 // of the initial browser window on Chrome startup.
23 // 23 //
24 // Note on usage: This function is idempotent and its overhead is low enough 24 // Note on usage: This function is idempotent and its overhead is low enough
25 // in comparison with UI display that it's OK to call it on every 25 // in comparison with UI display that it's OK to call it on every
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 timestamp.
31 // timestamp.
32 void RecordMainEntryPointTime(); 31 void RecordMainEntryPointTime();
33 32
34 // Call this when the executable is loaded and main() is entered. Can be 33 // Call this when the executable is loaded and main() is entered. Can be
35 // different from |RecordMainEntryPointTime| when the startup process is 34 // different from |RecordMainEntryPointTime| when the startup process is
36 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows. 35 // contained in a separate dll, such as with chrome.exe / chrome.dll on Windows.
37 void RecordExeMainEntryTime(); 36 void RecordExeMainEntryTime();
38 37
39 #if defined(OS_ANDROID) 38 // Call this with a previously recorded timestamp if unable to call on startup.
gab 2015/08/18 01:35:00 "if unable to call" what "on startup" ? "if unabl
msw 2015/08/18 17:59:48 Done.
40 // On Android the entry point time is the time at which the Java code starts. 39 // On Android, the entry point time is the time at which the Java code starts.
41 // This is recorded on the Java side, and then passed to the C++ side once the 40 // In Mojo, the entry point time is the time at which the shell starts.
42 // C++ library is loaded and running.
43 void RecordSavedMainEntryPointTime(const base::Time& entry_point_time); 41 void RecordSavedMainEntryPointTime(const base::Time& entry_point_time);
44 #endif // OS_ANDROID
45 42
46 // Called just before the message loop is about to start. Entry point to record 43 // Called just before the message loop is about to start. Entry point to record
47 // startup stats. 44 // startup stats.
48 // |is_first_run| - is the current launch part of a first run. 45 // |is_first_run| - is the current launch part of a first run.
49 void OnBrowserStartupComplete(bool is_first_run); 46 void OnBrowserStartupComplete(bool is_first_run);
50 47
51 // Returns the time of main entry recorded from RecordMainEntryPointTime. 48 // Returns the time of main entry recorded from RecordMainEntryPointTime.
52 // Returns NULL if that method has not yet been called. 49 // Returns NULL if that method has not yet been called.
53 // This method is expected to be called from the UI thread. 50 // This method is expected to be called from the UI thread.
54 const base::Time* MainEntryPointTime(); 51 const base::Time* MainEntryPointTime();
55 52
56 } // namespace startup_metric_utils 53 } // namespace startup_metric_utils
57 54
58 #endif // COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_ 55 #endif // COMPONENTS_STARTUP_METRIC_UTILS_STARTUP_METRIC_UTILS_H_
OLDNEW
« no previous file with comments | « components/html_viewer/stats_collection_controller.cc ('k') | components/startup_metric_utils/startup_metric_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698