Bug 1328398 - Add telemetry to measure service worker launch time. r=bkelly,francois datareview=francois

This patch is mainly to add a probe to measure sw launch time. To do this, this
patch records the sw launch time when the sw is just spwaned and it's ready to
handle the incoming fetch event.

MozReview-Commit-ID: 3w5MNyhQNnd

--HG--
extra : rebase_source : 3228213d0ea6be1d23b9c49382f1f8d3c2f358f1
This commit is contained in:
Tom Tung 2017-08-17 18:32:36 +08:00
Родитель 2e0a92099c
Коммит 3eb6957b71
4 изменённых файлов: 44 добавлений и 0 удалений

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

@ -1510,6 +1510,15 @@ public:
if (mMarkLaunchServiceWorkerEnd) {
mInterceptedChannel->SetLaunchServiceWorkerEnd(TimeStamp::Now());
// A probe to measure sw launch time for telemetry.
TimeStamp launchStartTime = TimeStamp();
mInterceptedChannel->GetLaunchServiceWorkerStart(&launchStartTime);
TimeStamp launchEndTime = TimeStamp();
mInterceptedChannel->GetLaunchServiceWorkerEnd(&launchEndTime);
Telemetry::AccumulateTimeDelta(Telemetry::SERVICE_WORKER_LAUNCH_TIME,
launchStartTime, launchEndTime);
}
mInterceptedChannel->SetDispatchFetchEventEnd(TimeStamp::Now());

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

@ -107,9 +107,17 @@ interface nsIInterceptedChannel : nsISupports
[noscript]
void SetLaunchServiceWorkerStart(in TimeStamp aTimeStamp);
// A hack to get sw launch start time for telemetry.
[noscript]
void GetLaunchServiceWorkerStart(out TimeStamp aTimeStamp);
[noscript]
void SetLaunchServiceWorkerEnd(in TimeStamp aTimeStamp);
// A hack to get sw launch end time for telemetry.
[noscript]
void GetLaunchServiceWorkerEnd(out TimeStamp aTimeStamp);
[noscript]
void SetDispatchFetchEventStart(in TimeStamp aTimeStamp);

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

@ -84,6 +84,14 @@ public:
return NS_OK;
}
NS_IMETHODIMP
GetLaunchServiceWorkerStart(TimeStamp* aTimeStamp) override
{
MOZ_DIAGNOSTIC_ASSERT(aTimeStamp);
*aTimeStamp = mLaunchServiceWorkerStart;
return NS_OK;
}
NS_IMETHODIMP
SetLaunchServiceWorkerEnd(TimeStamp aTimeStamp) override
{
@ -91,6 +99,14 @@ public:
return NS_OK;
}
NS_IMETHODIMP
GetLaunchServiceWorkerEnd(TimeStamp* aTimeStamp) override
{
MOZ_DIAGNOSTIC_ASSERT(aTimeStamp);
*aTimeStamp = mLaunchServiceWorkerEnd;
return NS_OK;
}
NS_IMETHODIMP
SetDispatchFetchEventStart(TimeStamp aTimeStamp) override
{

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

@ -11048,6 +11048,17 @@
"alert_emails": ["safebrowsing-telemetry@mozilla.org"],
"bug_numbers": [1058133]
},
"SERVICE_WORKER_LAUNCH_TIME": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",
"bug_numbers": [1328398],
"kind": "exponential",
"high": 5000,
"n_buckets": 25,
"releaseChannelCollection": "opt-out",
"alert_emails": ["sw-telemetry@mozilla.com", "ttung@mozilla.com"],
"description": "Time (ms) for a service worker to start up."
},
"SERVICE_WORKER_REGISTRATION_LOADING": {
"record_in_processes": ["main", "content"],
"expires_in_version": "never",