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

Unified Diff: components/subresource_filter/content/renderer/document_subresource_filter.cc

Issue 2503283003: Add high-precision timing histograms. (Closed)
Patch Set: Change measurement unit. Created 4 years 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/renderer/document_subresource_filter.cc
diff --git a/components/subresource_filter/content/renderer/document_subresource_filter.cc b/components/subresource_filter/content/renderer/document_subresource_filter.cc
index f17a1caff8492cdf3b1782ff47bd573f5eee4665..8e326a9edf16989e18fe6b7d56fb08d01bb75fc5 100644
--- a/components/subresource_filter/content/renderer/document_subresource_filter.cc
+++ b/components/subresource_filter/content/renderer/document_subresource_filter.cc
@@ -12,6 +12,7 @@
#include "base/trace_event/trace_event.h"
#include "components/subresource_filter/core/common/first_party_origin.h"
#include "components/subresource_filter/core/common/memory_mapped_ruleset.h"
+#include "components/subresource_filter/core/common/scoped_timers.h"
#include "third_party/WebKit/public/platform/WebURL.h"
namespace subresource_filter {
@@ -87,6 +88,11 @@ DocumentSubresourceFilter::DocumentSubresourceFilter(
? std::string()
: ancestor_document_urls[0].spec());
+ SCOPED_UMA_HISTOGRAM_MICRO_TIMER(
+ "SubresourceFilter.DocumentLoad.Activation.WallDuration");
+ SCOPED_UMA_HISTOGRAM_MICRO_THREAD_TIMER(
+ "SubresourceFilter.DocumentLoad.Activation.CPUDuration");
+
DCHECK_NE(activation_state_, ActivationState::DISABLED);
DCHECK(ruleset);
@@ -124,6 +130,19 @@ bool DocumentSubresourceFilter::allowLoad(
TRACE_EVENT1("loader", "DocumentSubresourceFilter::allowLoad", "url",
resourceUrl.string().utf8());
+ auto wall_duration_exporter = [this](base::TimeDelta delta) {
+ statistics_.evaluation_total_wall_duration += delta;
+ UMA_HISTOGRAM_MICRO_TIMES(
+ "SubresourceFilter.SubresourceLoad.Evaluation.WallDuration", delta);
+ };
+ auto cpu_duration_exporter = [this](base::TimeDelta delta) {
+ statistics_.evaluation_total_cpu_duration += delta;
+ UMA_HISTOGRAM_MICRO_TIMES(
+ "SubresourceFilter.SubresourceLoad.Evaluation.CPUDuration", delta);
+ };
+ SCOPED_TIMER(wall_duration_exporter);
+ SCOPED_THREAD_TIMER(cpu_duration_exporter);
+
++statistics_.num_loads_total;
if (filtering_disabled_for_document_)

Powered by Google App Engine
This is Rietveld 408576698