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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1127383009: Create histograms to track time-to-error values for different errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switched header file. Created 5 years, 7 months 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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",
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698