summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-26 20:31:47 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-26 20:31:47 +0000
commit1fcffcd71097402e4ff893de461046049dd5abcc (patch)
treef7c35df0984bfd51f9de7b2987db81d983d81b9e /webkit/appcache
parent870d43f466b01555a9638030d7b01533aaefda86 (diff)
downloadchromium_src-1fcffcd71097402e4ff893de461046049dd5abcc.zip
chromium_src-1fcffcd71097402e4ff893de461046049dd5abcc.tar.gz
chromium_src-1fcffcd71097402e4ff893de461046049dd5abcc.tar.bz2
Add an UMA stat for how long ResourceRequests are delayed due to the appcache.
BUG=166619 Review URL: https://codereview.chromium.org/11638009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache_histograms.cc15
-rw-r--r--webkit/appcache/appcache_histograms.h4
-rw-r--r--webkit/appcache/appcache_url_request_job.cc8
-rw-r--r--webkit/appcache/appcache_url_request_job.h1
4 files changed, 27 insertions, 1 deletions
diff --git a/webkit/appcache/appcache_histograms.cc b/webkit/appcache/appcache_histograms.cc
index ae2576f..f0b3c53 100644
--- a/webkit/appcache/appcache_histograms.cc
+++ b/webkit/appcache/appcache_histograms.cc
@@ -41,6 +41,21 @@ void AppCacheHistograms::AddCompletionRunTimeSample(
UMA_HISTOGRAM_TIMES("appcache.CompletionRunTime", duration);
}
+void AppCacheHistograms::AddNetworkJobStartDelaySample(
+ const base::TimeDelta& duration) {
+ UMA_HISTOGRAM_TIMES("appcache.JobStartDelay.Network", duration);
+}
+
+void AppCacheHistograms::AddErrorJobStartDelaySample(
+ const base::TimeDelta& duration) {
+ UMA_HISTOGRAM_TIMES("appcache.JobStartDelay.Error", duration);
+}
+
+void AppCacheHistograms::AddAppCacheJobStartDelaySample(
+ const base::TimeDelta& duration) {
+ UMA_HISTOGRAM_TIMES("appcache.JobStartDelay.AppCache", duration);
+}
+
void AppCacheHistograms::AddMissingManifestEntrySample() {
UMA_HISTOGRAM_BOOLEAN("appcache.MissingManifestEntry", true);
}
diff --git a/webkit/appcache/appcache_histograms.h b/webkit/appcache/appcache_histograms.h
index 3181b9a..0d9bd78c 100644
--- a/webkit/appcache/appcache_histograms.h
+++ b/webkit/appcache/appcache_histograms.h
@@ -32,7 +32,9 @@ class AppCacheHistograms {
static void AddTaskRunTimeSample(const base::TimeDelta& duration);
static void AddCompletionQueueTimeSample(const base::TimeDelta& duration);
static void AddCompletionRunTimeSample(const base::TimeDelta& duration);
-
+ static void AddNetworkJobStartDelaySample(const base::TimeDelta& duration);
+ static void AddErrorJobStartDelaySample(const base::TimeDelta& duration);
+ static void AddAppCacheJobStartDelaySample(const base::TimeDelta& duration);
static void AddMissingManifestEntrySample();
enum MissingManifestCallsiteType {
diff --git a/webkit/appcache/appcache_url_request_job.cc b/webkit/appcache/appcache_url_request_job.cc
index 80c0b7d..93351ac 100644
--- a/webkit/appcache/appcache_url_request_job.cc
+++ b/webkit/appcache/appcache_url_request_job.cc
@@ -19,6 +19,7 @@
#include "net/http/http_util.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_status.h"
+#include "webkit/appcache/appcache_histograms.h"
#include "webkit/appcache/appcache_service.h"
namespace appcache {
@@ -84,6 +85,8 @@ void AppCacheURLRequestJob::BeginDelivery() {
switch (delivery_type_) {
case NETWORK_DELIVERY:
+ AppCacheHistograms::AddNetworkJobStartDelaySample(
+ base::TimeTicks::Now() - start_time_tick_);
// To fallthru to the network, we restart the request which will
// cause a new job to be created to retrieve the resource from the
// network. Our caller is responsible for arranging to not re-intercept
@@ -92,6 +95,8 @@ void AppCacheURLRequestJob::BeginDelivery() {
break;
case ERROR_DELIVERY:
+ AppCacheHistograms::AddErrorJobStartDelaySample(
+ base::TimeTicks::Now() - start_time_tick_);
request()->net_log().AddEvent(
net::NetLog::TYPE_APPCACHE_DELIVERING_ERROR_RESPONSE);
NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
@@ -99,6 +104,8 @@ void AppCacheURLRequestJob::BeginDelivery() {
break;
case APPCACHED_DELIVERY:
+ AppCacheHistograms::AddAppCacheJobStartDelaySample(
+ base::TimeTicks::Now() - start_time_tick_);
request()->net_log().AddEvent(
is_fallback_ ?
net::NetLog::TYPE_APPCACHE_DELIVERING_FALLBACK_RESPONSE :
@@ -210,6 +217,7 @@ void AppCacheURLRequestJob::OnReadComplete(int result) {
void AppCacheURLRequestJob::Start() {
DCHECK(!has_been_started());
has_been_started_ = true;
+ start_time_tick_ = base::TimeTicks::Now();
MaybeBeginDelivery();
}
diff --git a/webkit/appcache/appcache_url_request_job.h b/webkit/appcache/appcache_url_request_job.h
index 67919b6..e26be53 100644
--- a/webkit/appcache/appcache_url_request_job.h
+++ b/webkit/appcache/appcache_url_request_job.h
@@ -131,6 +131,7 @@ class WEBKIT_STORAGE_EXPORT AppCacheURLRequestJob
virtual int GetResponseCode() const OVERRIDE;
AppCacheStorage* storage_;
+ base::TimeTicks start_time_tick_;
bool has_been_started_;
bool has_been_killed_;
DeliveryType delivery_type_;