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

Side by Side Diff: chrome/browser/chromeos/boot_times_loader.h

Issue 22262004: Drop struct BootStat and all usage (boot stats are now sent from chromeos code). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/boot_times_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ 6 #define CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 16 matching lines...) Expand all
27 // . In your class define a member field of type chromeos::BootTimesLoader and 27 // . In your class define a member field of type chromeos::BootTimesLoader and
28 // CancelableTaskTracker. 28 // CancelableTaskTracker.
29 // . Define the callback method, something like: 29 // . Define the callback method, something like:
30 // void OnBootTimesLoaded(const BootTimesLoader::BootTimes& boot_times); 30 // void OnBootTimesLoaded(const BootTimesLoader::BootTimes& boot_times);
31 // . When you want the version invoke: loader.GetBootTimes(callback, &tracker_); 31 // . When you want the version invoke: loader.GetBootTimes(callback, &tracker_);
32 class BootTimesLoader : public content::NotificationObserver { 32 class BootTimesLoader : public content::NotificationObserver {
33 public: 33 public:
34 BootTimesLoader(); 34 BootTimesLoader();
35 virtual ~BootTimesLoader(); 35 virtual ~BootTimesLoader();
36 36
37 // All fields are 0.0 if they couldn't be found.
38 typedef struct BootTimes {
39 double firmware; // Time from power button to kernel being loaded.
40 double pre_startup; // Time from kernel to system code being called.
41 double x_started; // Time X server is ready to be connected to.
42 double chrome_exec; // Time session manager executed Chrome.
43 double chrome_main; // Time chrome's main() was called.
44 double login_prompt_ready; // Time login (or OOB) panel is displayed.
45 double system; // Time system took to start chrome.
46 double chrome; // Time chrome took to display login panel.
47 double total; // Time from power button to login panel.
48
49 BootTimes() : firmware(0),
50 pre_startup(0),
51 x_started(0),
52 chrome_exec(0),
53 chrome_main(0),
54 login_prompt_ready(0),
55 system(0),
56 chrome(0),
57 total(0) {}
58 } BootTimes;
59
60 static BootTimesLoader* Get(); 37 static BootTimesLoader* Get();
61 38
62 typedef base::Callback<void(const BootTimes&)> GetBootTimesCallback;
63
64 // Asynchronously requests the info.
65 CancelableTaskTracker::TaskId GetBootTimes(
66 const GetBootTimesCallback& callback,
67 CancelableTaskTracker* tracker);
68
69 // Add a time marker for login. A timeline will be dumped to 39 // Add a time marker for login. A timeline will be dumped to
70 // /tmp/login-times-sent after login is done. If |send_to_uma| is true 40 // /tmp/login-times-sent after login is done. If |send_to_uma| is true
71 // the time between this marker and the last will be sent to UMA with 41 // the time between this marker and the last will be sent to UMA with
72 // the identifier BootTime.|marker_name|. 42 // the identifier BootTime.|marker_name|.
73 void AddLoginTimeMarker(const std::string& marker_name, bool send_to_uma); 43 void AddLoginTimeMarker(const std::string& marker_name, bool send_to_uma);
74 44
75 // Add a time marker for logout. A timeline will be dumped to 45 // Add a time marker for logout. A timeline will be dumped to
76 // /tmp/logout-times-sent after logout is done. If |send_to_uma| is true 46 // /tmp/logout-times-sent after logout is done. If |send_to_uma| is true
77 // the time between this marker and the last will be sent to UMA with 47 // the time between this marker and the last will be sent to UMA with
78 // the identifier ShutdownTime.|marker_name|. 48 // the identifier ShutdownTime.|marker_name|.
(...skipping 27 matching lines...) Expand all
106 // rely on notification service to tell when the logout is done. 76 // rely on notification service to tell when the logout is done.
107 void WriteLogoutTimes(); 77 void WriteLogoutTimes();
108 78
109 private: 79 private:
110 // BootTimesLoader calls into the Backend on the file thread to load 80 // BootTimesLoader calls into the Backend on the file thread to load
111 // the boot times. 81 // the boot times.
112 class Backend : public base::RefCountedThreadSafe<Backend> { 82 class Backend : public base::RefCountedThreadSafe<Backend> {
113 public: 83 public:
114 Backend() {} 84 Backend() {}
115 85
116 void GetBootTimesAndRunCallback(
117 const CancelableTaskTracker::IsCanceledCallback& is_canceled_cb,
118 const GetBootTimesCallback& callback);
119
120 private: 86 private:
121 friend class base::RefCountedThreadSafe<Backend>; 87 friend class base::RefCountedThreadSafe<Backend>;
122 88
123 ~Backend() {} 89 ~Backend() {}
124 90
125 DISALLOW_COPY_AND_ASSIGN(Backend); 91 DISALLOW_COPY_AND_ASSIGN(Backend);
126 }; 92 };
127 93
128 class TimeMarker { 94 class TimeMarker {
129 public: 95 public:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 std::vector<TimeMarker> login_time_markers_; 142 std::vector<TimeMarker> login_time_markers_;
177 std::vector<TimeMarker> logout_time_markers_; 143 std::vector<TimeMarker> logout_time_markers_;
178 std::set<content::RenderWidgetHost*> render_widget_hosts_loading_; 144 std::set<content::RenderWidgetHost*> render_widget_hosts_loading_;
179 145
180 DISALLOW_COPY_AND_ASSIGN(BootTimesLoader); 146 DISALLOW_COPY_AND_ASSIGN(BootTimesLoader);
181 }; 147 };
182 148
183 } // namespace chromeos 149 } // namespace chromeos
184 150
185 #endif // CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_ 151 #endif // CHROME_BROWSER_CHROMEOS_BOOT_TIMES_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/boot_times_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698