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

Unified Diff: components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc

Issue 2861053004: [subresource_filter] Add metrics for all NavigationThrottle delays (Closed)
Patch Set: shivanisha review Created 3 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
Index: components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
diff --git a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
index 0e755245c872288e89c058fef4010c9bb05cf36e..c48f137f6c72bee341f713b8d5dd072d487aebef 100644
--- a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
+++ b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
#include "components/subresource_filter/content/browser/async_document_subresource_filter.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
@@ -92,6 +93,8 @@ ActivationStateComputingNavigationThrottle::WillProcessResponse() {
base::Bind(&ActivationStateComputingNavigationThrottle::
OnActivationStateComputed,
weak_ptr_factory_.GetWeakPtr()));
+
+ defer_timestamp_ = base::TimeTicks::Now();
return content::NavigationThrottle::ThrottleCheckResult::DEFER;
}
@@ -101,6 +104,15 @@ const char* ActivationStateComputingNavigationThrottle::GetNameForLogging() {
void ActivationStateComputingNavigationThrottle::OnActivationStateComputed(
ActivationState state) {
+ DCHECK(!defer_timestamp_.is_null());
+ base::TimeDelta delay = base::TimeTicks::Now() - defer_timestamp_;
+ UMA_HISTOGRAM_TIMES("SubresourceFilter.DocumentLoad.ActivationComputingDelay",
pkalinnikov 2017/05/08 12:00:05 Do you expect it to be mostly >= 1 ms? We also ha
Charlie Harrison 2017/05/08 12:53:33 Yeah we can us microseconds for these metrics (may
+ delay);
+ if (navigation_handle()->IsInMainFrame()) {
+ UMA_HISTOGRAM_TIMES(
+ "SubresourceFilter.DocumentLoad.ActivationComputingDelay.MainFrame",
+ delay);
+ }
navigation_handle()->Resume();
}

Powered by Google App Engine
This is Rietveld 408576698