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

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

Issue 2951643003: Add UMA that periodically logs number of outstanding requests (Closed)
Patch Set: Msec -> Sec and style fix Created 3 years, 6 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: content/browser/loader/resource_dispatcher_host_impl.h
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h
index 3f5aa959c691d7b6d091ec99a4a24a06c1ffc08a..70f377e30619a43c1c6872efd39212591199572b 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.h
+++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -457,6 +457,13 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
int count,
ResourceRequestInfoImpl* info);
+ // Called from IncrementOutstandingRequestsCount to update the per-tab
+ // request stats in |outstanding_requests_per_tab_map_|.
+ // TODO(ksakamoto): This is just for temporary metrics collection for the
+ // Loading Dispatcher v0 (crbug.com/723233), and will be removed soon.
+ void IncrementOutstandingRequestsPerTab(int count,
+ const ResourceRequestInfoImpl& info);
+
// Estimate how much heap space |request| will consume to run.
static int CalculateApproximateMemoryCost(net::URLRequest* request);
@@ -513,6 +520,10 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// Checks all pending requests and updates the load info if necessary.
void UpdateLoadInfo();
+ // Records statistics about outstanding requests since the last call, and
+ // reset the stats.
+ void RecordOutstandingRequestsStats();
+
// Resumes or cancels (if |cancel_requests| is true) any blocked requests.
void ProcessBlockedRequestsForRoute(
const GlobalFrameRoutingId& global_routing_id,
@@ -695,6 +706,10 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
bool must_download,
bool is_new_request);
+ // Returns true if there are two or more tabs that are not network 2-quiet
+ // (i.e. have at least three outstanding requests).
+ bool HasRequestsFromMultipleActiveTabs();
+
LoaderMap pending_loaders_;
// Collection of temp files downloaded for child processes via
@@ -710,6 +725,10 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// not empty and at least one RenderViewHost is loading.
std::unique_ptr<base::RepeatingTimer> update_load_states_timer_;
+ // A timer that periodically calls RecordOutstandingRequestsStats.
+ std::unique_ptr<base::RepeatingTimer>
+ record_outstanding_requests_stats_timer_;
+
// Request ID for browser initiated requests. request_ids generated by
// child processes are counted up from 0, while browser created requests
// start at -2 and go down from there. (We need to start at -2 because -1 is
@@ -732,6 +751,14 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
typedef std::map<int, OustandingRequestsStats> OutstandingRequestsStatsMap;
OutstandingRequestsStatsMap outstanding_requests_stats_map_;
+ // Maps (child_id, route_id) to the number of outstanding requests.
+ // Used only when OOPIF is not enabled, since in OOPIF modes routing_id
+ // doesn't represent tabs.
+ // TODO(ksakamoto): This is just for temporary metrics collection for the
+ // Loading Dispatcher v0 (crbug.com/723233), and will be removed soon.
+ typedef std::map<std::pair<int, int>, int> OutstandingRequestsPerTabMap;
+ OutstandingRequestsPerTabMap outstanding_requests_per_tab_map_;
+
// |num_in_flight_requests_| is the total number of requests currently issued
// summed across all renderers.
int num_in_flight_requests_;
@@ -763,6 +790,15 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// Largest number of outstanding requests seen so far in any single process.
int largest_outstanding_request_per_process_count_seen_;
+ // Largest number of outstanding requests seen since the last call to
+ // RecordOutstandingRequestsStats.
+ int peak_outstanding_request_count_ = 0;
+
+ // Largest number of outstanding requests seen while there are outstanding
+ // requests from two or more tabs, since the last call to
+ // RecordOutstandingRequestsStats.
+ int peak_outstanding_request_count_multitab_ = 0;
+
// Time of the last user gesture. Stored so that we can add a load
// flag to requests occurring soon after a gesture to indicate they
// may be because of explicit user action.

Powered by Google App Engine
This is Rietveld 408576698