Index: content/browser/loader/resource_dispatcher_host_impl.cc |
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc |
index d758f687987af444c94f1ed25d29cfbd25fc31d5..9828244029a1c007a783ddeea6f32121cffe1eb7 100644 |
--- a/content/browser/loader/resource_dispatcher_host_impl.cc |
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
@@ -19,11 +19,12 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/shared_memory.h" |
#include "base/message_loop/message_loop.h" |
-#include "base/metrics/histogram.h" |
+#include "base/metrics/histogram_macros.h" |
#include "base/metrics/sparse_histogram.h" |
#include "base/profiler/scoped_tracker.h" |
#include "base/stl_util.h" |
#include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
+#include "base/time/time.h" |
#include "content/browser/appcache/appcache_interceptor.h" |
#include "content/browser/appcache/chrome_appcache_service.h" |
#include "content/browser/cert_store_impl.h" |
@@ -862,6 +863,45 @@ void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) { |
"Net.ErrorCodesForMainFrame3", |
-loader->request()->status().error()); |
+ // Record time to success and error for the most common errors, and for |
+ // the aggregate remainder errors. |
+ base::TimeDelta request_loading_time( |
+ base::Time::Now() - loader->request()->request_time()); |
+ switch (loader->request()->status().error()) { |
+ case net::OK: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.Success", request_loading_time); |
+ break; |
+ case net::ERR_ABORTED: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.ErrAborted", request_loading_time); |
+ break; |
+ case net::ERR_CONNECTION_RESET: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.ErrConnectionReset", request_loading_time); |
+ break; |
+ case net::ERR_CONNECTION_TIMED_OUT: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.ErrConnectionTimedOut", request_loading_time); |
+ break; |
+ case net::ERR_INTERNET_DISCONNECTED: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.ErrInternetDisconnected", request_loading_time); |
+ break; |
+ case net::ERR_NAME_NOT_RESOLVED: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.ErrNameNotResolved", request_loading_time); |
+ break; |
+ case net::ERR_TIMED_OUT: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.ErrTimedOut", request_loading_time); |
+ break; |
+ default: |
+ UMA_HISTOGRAM_LONG_TIMES( |
+ "Net.RequestTime.MiscError", request_loading_time); |
+ break; |
+ } |
+ |
if (loader->request()->url().SchemeIsCryptographic()) { |
if (loader->request()->url().host() == "www.google.com") { |
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ErrorCodesForHTTPSGoogleMainFrame2", |