Bug 708812 - Add telemetry probes for Android startup. r=blassey

This commit is contained in:
Gian-Carlo Pascutto 2012-10-01 17:15:28 +02:00
Родитель 5e680f0531
Коммит bcd70df75c
5 изменённых файлов: 75 добавлений и 10 удалений

Просмотреть файл

@ -78,6 +78,7 @@ public class AboutHomeContent extends ScrollView
private BrowserApp mActivity;
private Cursor mCursor;
UriLoadCallback mUriLoadCallback = null;
VoidCallback mLoadCompleteCallback = null;
private LayoutInflater mInflater;
private AccountManager mAccountManager;
@ -99,6 +100,10 @@ public class AboutHomeContent extends ScrollView
public void callback(String uriSpec);
}
public interface VoidCallback {
public void callback();
}
public AboutHomeContent(Context context) {
super(context);
mContext = context;
@ -284,6 +289,12 @@ public class AboutHomeContent extends ScrollView
// Free the old Cursor in the right thread now.
if (oldCursor != null && !oldCursor.isClosed())
oldCursor.close();
// Even if AboutHome isn't necessarily entirely loaded if we
// get here, for phones this is the part the user initially sees,
// so it's the one we will care about for now.
if (mLoadCompleteCallback != null)
mLoadCompleteCallback.callback();
}
});
}
@ -310,6 +321,10 @@ public class AboutHomeContent extends ScrollView
mUriLoadCallback = uriLoadCallback;
}
public void setLoadCompleteCallback(VoidCallback callback) {
mLoadCompleteCallback = callback;
}
public void onActivityContentChanged() {
update(EnumSet.of(UpdateFlags.TOP_SITES));
}

Просмотреть файл

@ -639,12 +639,16 @@ abstract public class BrowserApp extends GeckoApp
loadUrl(url, AwesomeBar.Target.CURRENT_TAB);
}
});
mAboutHomeContent.setLoadCompleteCallback(new AboutHomeContent.VoidCallback() {
public void callback() {
mAboutHomeStartupTimer.stop();
}
});
mAboutHomeContent.setOnInterceptTouchListener(new ContentTouchListener());
} else {
mAboutHomeContent.update(EnumSet.of(AboutHomeContent.UpdateFlags.TOP_SITES,
AboutHomeContent.UpdateFlags.REMOTE_TABS));
}
mAboutHomeContent.setVisibility(View.VISIBLE);
} else {
findViewById(R.id.abouthome_content).setVisibility(View.GONE);

Просмотреть файл

@ -176,6 +176,9 @@ abstract public class GeckoApp
protected int mRestoreMode = GeckoAppShell.RESTORE_NONE;
protected boolean mInitialized = false;
protected Telemetry.Timer mAboutHomeStartupTimer;
private Telemetry.Timer mJavaUiStartupTimer;
private Telemetry.Timer mGeckoReadyStartupTimer;
public enum LaunchState {Launching, WaitForDebugger,
Launched, GeckoRunning, GeckoExiting};
@ -970,6 +973,7 @@ abstract public class GeckoApp
final int tabId = message.getInt("tabID");
handlePageShow(tabId);
} else if (event.equals("Gecko:Ready")) {
mGeckoReadyStartupTimer.stop();
sIsGeckoReady = true;
setLaunchState(GeckoApp.LaunchState.GeckoRunning);
GeckoAppShell.sendPendingEventsToGecko();
@ -1439,9 +1443,15 @@ abstract public class GeckoApp
@Override
public void onCreate(Bundle savedInstanceState)
{
((GeckoApplication)getApplication()).initialize();
GeckoAppShell.registerGlobalExceptionHandler();
// The clock starts...now. Better hurry!
mJavaUiStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_JAVACHROME");
mAboutHomeStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_ABOUTHOME");
mGeckoReadyStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_GECKOREADY");
((GeckoApplication)getApplication()).initialize();
mAppContext = this;
Tabs.getInstance().attachToActivity(this);
@ -1690,6 +1700,9 @@ abstract public class GeckoApp
final GeckoApp self = this;
// End of the startup of our Java App
mJavaUiStartupTimer.stop();
GeckoAppShell.getHandler().postDelayed(new Runnable() {
public void run() {
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - pre checkLaunchState");

Просмотреть файл

@ -37,13 +37,22 @@ public class Telemetry {
public static class Timer {
private long mStartTime;
private String mName;
private boolean mHasFinished;
public Timer(String name) {
mName = name;
mStartTime = SystemClock.uptimeMillis();
mHasFinished = false;
}
public void stop() {
// Only the first stop counts.
if (mHasFinished) {
return;
} else {
mHasFinished = true;
}
long elapsed = SystemClock.uptimeMillis() - mStartTime;
if (elapsed < Integer.MAX_VALUE) {
HistogramAdd(mName, (int)(elapsed));

Просмотреть файл

@ -26,14 +26,6 @@
"n_buckets": 50,
"description": "time spent updating accessibility (ms)"
},
"FENNEC_AWESOMEBAR_ALLPAGES_EMPTY_TIME": {
"kind": "exponential",
"low": 10,
"high": "20000",
"n_buckets": 20,
"description": "Fennec: Time for the Awesomebar Top Sites query to return with no filter set (ms)",
"cpp_guard": "ANDROID"
},
"CYCLE_COLLECTOR": {
"kind": "exponential",
"high": "10000",
@ -2243,6 +2235,38 @@
"description": "Number of history entries in the original XUL places database",
"cpp_guard": "ANDROID"
},
"FENNEC_AWESOMEBAR_ALLPAGES_EMPTY_TIME": {
"kind": "exponential",
"low": 10,
"high": "20000",
"n_buckets": 20,
"description": "Fennec: Time for the Awesomebar Top Sites query to return with no filter set (ms)",
"cpp_guard": "ANDROID"
},
"FENNEC_STARTUP_TIME_JAVAUI": {
"kind": "exponential",
"low": 100,
"high": "5000",
"n_buckets": 20,
"description": "Time for the Java UI to load (ms)",
"cpp_guard": "ANDROID"
},
"FENNEC_STARTUP_TIME_ABOUTHOME": {
"kind": "exponential",
"low": 100,
"high": "10000",
"n_buckets": 20,
"description": "Time for the about:home page to be displayed (ms)",
"cpp_guard": "ANDROID"
},
"FENNEC_STARTUP_TIME_GECKOREADY": {
"kind": "exponential",
"low": 500,
"high": "20000",
"n_buckets": 20,
"description": "Time for the Gecko:Ready message to arrive (ms)",
"cpp_guard": "ANDROID"
},
"OUT_OF_MEMORY_KILLED": {
"kind": "flag",
"description": "Killed due to an OOM condition",