Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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 CHROMEOS_LOGIN_EVENT_RECORDER_H_ | |
| 6 #define CHROMEOS_LOGIN_EVENT_RECORDER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "chromeos/chromeos_export.h" | |
| 12 | |
| 13 namespace chromeos { | |
| 14 | |
| 15 // BootTimesLoader loads the bootimes of Chrome OS from the file system. | |
|
Nikita (slow)
2014/07/16 16:57:45
nit: Comments needs to be updated.
| |
| 16 // Loading is done asynchronously on the file thread. Once loaded, | |
| 17 // BootTimesLoader calls back to a method of your choice with the boot times. | |
| 18 // To use BootTimesLoader, do the following: | |
| 19 // | |
| 20 // . In your class define a member field of type chromeos::BootTimesLoader and | |
| 21 // base::CancelableTaskTracker. | |
| 22 // . Define the callback method, something like: | |
| 23 // void OnBootTimesLoaded(const BootTimesLoader::BootTimes& boot_times); | |
| 24 // . When you want the version invoke: loader.GetBootTimes(callback, &tracker_); | |
| 25 class CHROMEOS_EXPORT LoginEventRecorder { | |
| 26 public: | |
| 27 class Delegate { | |
| 28 public: | |
| 29 virtual void AddLoginTimeMarker(const std::string& marker_name, | |
| 30 bool send_to_uma) = 0; | |
| 31 }; | |
| 32 LoginEventRecorder(); | |
| 33 virtual ~LoginEventRecorder(); | |
| 34 | |
| 35 static LoginEventRecorder* Get(); | |
| 36 | |
| 37 void SetDelegate(Delegate* delegate); | |
| 38 | |
| 39 // Add a time marker for login. A timeline will be dumped to | |
| 40 // /tmp/login-times-sent after login is done. If |send_to_uma| is true | |
| 41 // the time between this marker and the last will be sent to UMA with | |
| 42 // the identifier BootTime.|marker_name|. | |
| 43 void AddLoginTimeMarker(const std::string& marker_name, bool send_to_uma); | |
| 44 | |
| 45 private: | |
| 46 Delegate* delegate_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(LoginEventRecorder); | |
| 49 }; | |
| 50 | |
| 51 } // namespace chromeos | |
| 52 | |
| 53 #endif // CHROMEOS_LOGIN_EVENT_RECORDER_H_ | |
| OLD | NEW |