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

Unified Diff: chrome/browser/extensions/user_script_listener.cc

Issue 1011363005: [Extensions] Add metrics for UserScriptListener (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_listener.cc
diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc
index 232b365e0067ea526dc364614f3f2da6bab14da0..dd7060a1b626265f72aca1a7342b75645e8924e0 100644
--- a/chrome/browser/extensions/user_script_listener.cc
+++ b/chrome/browser/extensions/user_script_listener.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/extensions/user_script_listener.h"
#include "base/bind.h"
+#include "base/metrics/histogram.h"
Mark P 2015/03/19 18:59:15 histogram_macros is more appropriate
Devlin 2015/03/19 19:45:54 Done.
+#include "base/timer/elapsed_timer.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
@@ -34,8 +36,11 @@ class UserScriptListener::Throttle
DCHECK(should_defer_);
should_defer_ = false;
// Only resume the request if |this| has deferred it.
- if (did_defer_)
+ if (did_defer_) {
+ UMA_HISTOGRAM_TIMES("Extensions.ThrottledNetworkRequestDelay",
+ timer_->Elapsed());
not at google - send to devlin 2015/03/19 15:41:14 For completeness, timer_.reset()?
Devlin 2015/03/19 16:59:52 These are deleted right after resume is called, bu
controller()->Resume();
+ }
}
// ResourceThrottle implementation:
@@ -44,6 +49,7 @@ class UserScriptListener::Throttle
if (should_defer_) {
*defer = true;
did_defer_ = true;
+ timer_.reset(new base::ElapsedTimer());
}
}
@@ -54,6 +60,9 @@ class UserScriptListener::Throttle
private:
bool should_defer_;
bool did_defer_;
+ scoped_ptr<base::ElapsedTimer> timer_;
+
+ DISALLOW_COPY_AND_ASSIGN(Throttle);
};
struct UserScriptListener::ProfileData {
@@ -131,6 +140,8 @@ bool UserScriptListener::ShouldDelayRequest(const GURL& url,
}
void UserScriptListener::StartDelayedRequests() {
+ UMA_HISTOGRAM_COUNTS_100("Extensions.ThrottledNetworkRequests",
+ throttles_.size());
WeakThrottleList::const_iterator it;
for (it = throttles_.begin(); it != throttles_.end(); ++it) {
if (it->get())
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698