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

Unified Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 706253003: ServiceWorker: Add UMA to measure execution times of onpush (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async_push_finished_2
Patch Set: Only log for successful executions Created 6 years, 1 month 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
Index: content/renderer/service_worker/service_worker_script_context.cc
diff --git a/content/renderer/service_worker/service_worker_script_context.cc b/content/renderer/service_worker/service_worker_script_context.cc
index fe8e4446af094566a674c4e32898f7af64fc778a..33f4dd0d124ef0dde6061fad678da37d85bf24e5 100644
--- a/content/renderer/service_worker/service_worker_script_context.cc
+++ b/content/renderer/service_worker/service_worker_script_context.cc
@@ -131,8 +131,15 @@ void ServiceWorkerScriptContext::DidHandleFetchEvent(
void ServiceWorkerScriptContext::DidHandlePushEvent(
int request_id,
- blink::WebServiceWorkerEventResult unused) {
+ blink::WebServiceWorkerEventResult result) {
// TODO(johnme): Plumb through the result.
+ if (result == blink::WebServiceWorkerEventResultCompleted) {
+ UMA_HISTOGRAM_TIMES(
+ "ServiceWorker.PushEventExecutionTime",
+ base::TimeTicks::Now() - push_start_timings_[request_id]);
+ }
+ push_start_timings_.erase(request_id);
+
Send(new ServiceWorkerHostMsg_PushEventFinished(
GetRoutingID(), request_id));
}
@@ -229,6 +236,7 @@ void ServiceWorkerScriptContext::OnPushEvent(int request_id,
const std::string& data) {
TRACE_EVENT0("ServiceWorker",
"ServiceWorkerScriptContext::OnPushEvent");
+ push_start_timings_[request_id] = base::TimeTicks::Now();
proxy_->dispatchPushEvent(request_id, blink::WebString::fromUTF8(data));
}
« no previous file with comments | « content/renderer/service_worker/service_worker_script_context.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698