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

Unified Diff: chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc

Issue 2803673002: Add metrics for DelayNavigationThrottle (Closed)
Patch Set: revert inadvertent file change Created 3 years, 8 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
Index: chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc
diff --git a/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc b/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc
index 503641accdcb8e77444713f3069cf4450be5a4a5..bc32e8f18d5907286025bdc6205b580ab1bb48a5 100644
--- a/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc
+++ b/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc
@@ -6,6 +6,7 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
+#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/profiles/profile.h"
@@ -15,6 +16,13 @@
namespace {
+const char kHistogramNavigationDelaySpecified[] =
+ "DelayNavigationThrottle.Delay.Specified";
+const char kHistogramNavigationDelayActual[] =
+ "DelayNavigationThrottle.Delay.Actual";
+const char kHistogramNavigationDelayDelta[] =
+ "DelayNavigationThrottle.Delay.Delta";
+
base::TimeDelta GetNavigationDelayFromParams() {
double delay_probability = base::GetFieldTrialParamByFeatureAsDouble(
kDelayNavigationFeature,
@@ -100,6 +108,8 @@ DelayNavigationThrottle::~DelayNavigationThrottle() {}
content::NavigationThrottle::ThrottleCheckResult
DelayNavigationThrottle::WillStartRequest() {
+ UMA_HISTOGRAM_TIMES(kHistogramNavigationDelaySpecified, navigation_delay_);
+ delay_start_time_ = base::TimeTicks::Now();
task_runner_->PostDelayedTask(
FROM_HERE,
base::Bind(&DelayNavigationThrottle::OnDelayComplete,
@@ -109,5 +119,9 @@ DelayNavigationThrottle::WillStartRequest() {
}
void DelayNavigationThrottle::OnDelayComplete() {
+ base::TimeDelta actual_delay = base::TimeTicks::Now() - delay_start_time_;
+ base::TimeDelta delay_delta = actual_delay - navigation_delay_;
+ UMA_HISTOGRAM_TIMES(kHistogramNavigationDelayActual, actual_delay);
+ UMA_HISTOGRAM_TIMES(kHistogramNavigationDelayDelta, delay_delta.magnitude());
Charlie Harrison 2017/04/05 16:54:37 if actual_delay < navigation_delay_ this could be
Bryan McQuade 2017/04/05 20:11:05 copying the relevant part of my general reply here
navigation_handle()->Resume();
}
« no previous file with comments | « chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698