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

Unified Diff: chrome/browser/ui/app_list/app_list_service.cc

Issue 366233002: Refine UMA quality for warm-start app list cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to master Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/app_list/win/app_list_service_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/app_list_service.cc
diff --git a/chrome/browser/ui/app_list/app_list_service.cc b/chrome/browser/ui/app_list/app_list_service.cc
index 467110509272c6d4dc4e44105ddac7a4ac1b2e83..22e8e862f5f4ad061555bd935e2f1ac7e7263090 100644
--- a/chrome/browser/ui/app_list/app_list_service.cc
+++ b/chrome/browser/ui/app_list/app_list_service.cc
@@ -21,6 +21,15 @@ enum StartupType {
WARM_START_FAST,
};
+// For when an app list show request is received via CommandLine. Indicates
+// whether the Profile the app list was previously showing was the SAME, OTHER
+// or NONE with respect to the new Profile to show.
+enum ProfileLoadState {
+ PROFILE_LOADED_SAME,
+ PROFILE_LOADED_OTHER,
+ PROFILE_LOADED_NONE,
+};
+
base::Time GetOriginalProcessStartTime(const CommandLine& command_line) {
if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) {
std::string start_time_string =
@@ -57,26 +66,39 @@ int64 g_original_process_start_time;
// The type of startup the the current app list show has gone through.
StartupType g_app_show_startup_type;
+// The state of the active app list profile at the most recent launch.
+ProfileLoadState g_profile_load_state;
+
void RecordFirstPaintTiming() {
base::Time start_time(
base::Time::FromInternalValue(g_original_process_start_time));
base::TimeDelta elapsed = base::Time::Now() - start_time;
switch (g_app_show_startup_type) {
case COLD_START:
+ DCHECK_EQ(PROFILE_LOADED_NONE, g_profile_load_state);
UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintColdStart", elapsed);
break;
case WARM_START:
- UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStart", elapsed);
+ // For warm starts, only record showing the same profile. "NONE" should
+ // only occur in the first 30 seconds after startup. "OTHER" only occurs
+ // for multi-profile cases. In these cases, timings are also affected by
+ // whether or not a profile has been loaded from disk, which makes the
+ // profile load asynchronous and skews results unpredictably.
+ if (g_profile_load_state == PROFILE_LOADED_SAME)
+ UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStart", elapsed);
break;
case WARM_START_FAST:
- UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStartFast",
- elapsed);
+ if (g_profile_load_state == PROFILE_LOADED_SAME) {
+ UMA_HISTOGRAM_LONG_TIMES("Startup.AppListFirstPaintWarmStartFast",
+ elapsed);
+ }
break;
}
}
void RecordStartupInfo(AppListService* service,
- const CommandLine& command_line) {
+ const CommandLine& command_line,
+ Profile* launch_profile) {
base::Time start_time = GetOriginalProcessStartTime(command_line);
if (start_time.is_null())
return;
@@ -97,6 +119,15 @@ void RecordStartupInfo(AppListService* service,
g_original_process_start_time = start_time.ToInternalValue();
g_app_show_startup_type = startup_type;
+
+ Profile* current_profile = service->GetCurrentAppListProfile();
+ if (!current_profile)
+ g_profile_load_state = PROFILE_LOADED_NONE;
+ else if (current_profile == launch_profile)
+ g_profile_load_state = PROFILE_LOADED_SAME;
+ else
+ g_profile_load_state = PROFILE_LOADED_OTHER;
+
service->SetAppListNextPaintCallback(RecordFirstPaintTiming);
}
@@ -136,7 +167,7 @@ bool AppListService::HandleLaunchCommandLine(
// The --show-app-list switch is used for shortcuts on the native desktop.
AppListService* service = Get(chrome::HOST_DESKTOP_TYPE_NATIVE);
DCHECK(service);
- RecordStartupInfo(service, command_line);
+ RecordStartupInfo(service, command_line, launch_profile);
service->ShowForProfile(launch_profile);
return true;
}
« no previous file with comments | « no previous file | chrome/browser/ui/views/app_list/win/app_list_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698