diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 23:50:16 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 23:50:16 +0000 |
commit | 03b3d3fe34206d788cef52947de0093c4aa100da (patch) | |
tree | a74e8ec14b4d4b6d106673626ae607ee0d73d828 /chrome | |
parent | 040b800f9a064e093255e1e5e2718b1cd51275a3 (diff) | |
download | chromium_src-03b3d3fe34206d788cef52947de0093c4aa100da.zip chromium_src-03b3d3fe34206d788cef52947de0093c4aa100da.tar.gz chromium_src-03b3d3fe34206d788cef52947de0093c4aa100da.tar.bz2 |
Add time for when chrome's main() is called.
Also output chrome's time to launch on the login screen.
Review URL: http://codereview.chromium.org/2003001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/boot_times_loader.cc | 11 | ||||
-rw-r--r-- | chrome/browser/chromeos/boot_times_loader.h | 4 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/background_view.cc | 33 |
4 files changed, 45 insertions, 9 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 3f54f04..9e2becc 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -397,7 +397,11 @@ DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, #elif defined(OS_POSIX) int ChromeMain(int argc, char** argv) { #endif - +#if defined(OS_CHROMEOS) + // Output our start times. + system("set -o noclobber ; cat /proc/uptime > /tmp/uptime-chrome-main"); + system("set -o noclobber ; cat /sys/block/sda/stat > /tmp/disk-chrome-main"); +#endif #if defined(OS_MACOSX) // TODO(mark): Some of these things ought to be handled in chrome_exe_main.mm. // Under the current architecture, nothing in chrome_exe_main can rely diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 86354ae5..c169298 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -100,12 +100,21 @@ void BootTimesLoader::Backend::GetBootTimes( const char* kClockSpeedCommand = "dmesg | grep -e 'Detected.*processor'"; const char* kClockSpeedPrefix = "Detected "; const char* kPreStartup = "uptime-pre-startup"; + const char* kChromeExec = "uptime-chrome-exec"; + const char* kChromeMain = "uptime-chrome-main"; const char* kXStarted = "uptime-x-started"; const char* kLoginPromptReady = "uptime-login-prompt-ready"; if (request->canceled()) return; + // Wait until login_prompt_ready is output. + FilePath log_dir(kLogPath); + FilePath log_file = log_dir.Append(kLoginPromptReady); + while (!file_util::PathExists(log_file)) { + usleep(500000); + } + BootTimes boot_times; std::string tsc_value = ExecuteInShell(kInitialTSCCommand, kInitialTSCPrefix); std::string speed_value = @@ -122,6 +131,8 @@ void BootTimesLoader::Backend::GetBootTimes( } GetUptime(kPreStartup, &boot_times.pre_startup); GetUptime(kXStarted, &boot_times.x_started); + GetUptime(kChromeExec, &boot_times.chrome_exec); + GetUptime(kChromeMain, &boot_times.chrome_main); GetUptime(kLoginPromptReady, &boot_times.login_prompt_ready); request->ForwardResult( diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h index ad7109b..3592027 100644 --- a/chrome/browser/chromeos/boot_times_loader.h +++ b/chrome/browser/chromeos/boot_times_loader.h @@ -32,11 +32,15 @@ class BootTimesLoader : public CancelableRequestProvider { double firmware; // Time from power button to kernel being loaded. double pre_startup; // Time from kernel to system code being called. double x_started; // Time X server is ready to be connected to. + double chrome_exec; // Time session manager executed Chrome. + double chrome_main; // Time chrome's main() was called. double login_prompt_ready; // Time login (or OOB) panel is displayed. BootTimes() : firmware(0), pre_startup(0), x_started(0), + chrome_exec(0), + chrome_main(0), login_prompt_ready(0) {} } BootTimes; diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc index 6e4e54a..e57c4d7 100644 --- a/chrome/browser/chromeos/login/background_view.cc +++ b/chrome/browser/chromeos/login/background_view.cc @@ -198,14 +198,31 @@ void BackgroundView::OnBootTimes( BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times) { // TODO(davemoore) if we decide to keep these times visible we will need // to localize the strings. - std::string boot_times_text = - StringPrintf( - "Boot took %.2f seconds " - "(firmware %.2fs, kernel %.2fs, user %.2fs)", - boot_times.firmware + boot_times.login_prompt_ready, - boot_times.firmware, - boot_times.pre_startup, - boot_times.login_prompt_ready - boot_times.pre_startup); + const char* kBootTimesNoChromeExec = + "Boot took %.2f seconds (firmware %.2fs, kernel %.2fs, system %.2fs)"; + const char* kBootTimesChromeExec = + "Boot took %.2f seconds " + "(firmware %.2fs, kernel %.2fs, system %.2fs, chrome %.2fs)"; + std::string boot_times_text; + + if (boot_times.chrome_exec > 0) { + boot_times_text = + StringPrintf( + kBootTimesChromeExec, + boot_times.firmware + boot_times.login_prompt_ready, + boot_times.firmware, + boot_times.pre_startup, + boot_times.chrome_exec - boot_times.pre_startup, + boot_times.login_prompt_ready - boot_times.chrome_exec); + } else { + boot_times_text = + StringPrintf( + kBootTimesNoChromeExec, + boot_times.firmware + boot_times.login_prompt_ready, + boot_times.firmware, + boot_times.pre_startup, + boot_times.login_prompt_ready - boot_times.pre_startup); + } boot_times_label_->SetText(ASCIIToWide(boot_times_text)); } |