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

Side by Side Diff: net/http/http_stream_factory_impl.cc

Issue 2752193003: Add histograms to track the number of job controller and job that are (Closed)
Patch Set: address Helen's comments Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <tuple> 8 #include <tuple>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, 98 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session,
99 bool for_websockets) 99 bool for_websockets)
100 : session_(session), 100 : session_(session),
101 job_factory_(new DefaultJobFactory()), 101 job_factory_(new DefaultJobFactory()),
102 for_websockets_(for_websockets) {} 102 for_websockets_(for_websockets) {}
103 103
104 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() { 104 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() {
105 DCHECK(request_map_.empty()); 105 DCHECK(request_map_.empty());
106 DCHECK(spdy_session_request_map_.empty()); 106 DCHECK(spdy_session_request_map_.empty());
107 size_t alt_job_count = 0;
108 size_t main_job_count = 0;
109 size_t preconnect_controller_count = 0;
Alexei Svitkine (slow) 2017/03/20 15:51:58 Nit: Just use int since these are not compared wit
xunjieli 2017/03/20 16:37:35 Is this written somewhere? According to https://ch
Alexei Svitkine (slow) 2017/03/20 16:56:04 The normal C++ style guide suggests to use int typ
Zhongyi Shi 2017/03/20 21:26:35 Done.
110 for (const auto& it : job_controller_set_) {
111 DCHECK(it->HasPendingAltJob() || it->HasPendingMainJob());
112 // For a preconnect controller, it should have exactly the main job.
113 if (it->is_preconnect()) {
114 preconnect_controller_count++;
115 continue;
116 }
117 // For non-preconnects.
118 if (it->HasPendingAltJob())
119 alt_job_count++;
120 if (it->HasPendingMainJob())
121 main_job_count++;
122 }
123 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfPreconnect",
124 preconnect_controller_count);
125 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectAltJob",
126 alt_job_count);
127 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfNonPreconnectMainJob",
128 main_job_count);
107 } 129 }
108 130
109 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( 131 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream(
110 const HttpRequestInfo& request_info, 132 const HttpRequestInfo& request_info,
111 RequestPriority priority, 133 RequestPriority priority,
112 const SSLConfig& server_ssl_config, 134 const SSLConfig& server_ssl_config,
113 const SSLConfig& proxy_ssl_config, 135 const SSLConfig& proxy_ssl_config,
114 HttpStreamRequest::Delegate* delegate, 136 HttpStreamRequest::Delegate* delegate,
115 const NetLogWithSource& net_log) { 137 const NetLogWithSource& net_log) {
116 DCHECK(!for_websockets_); 138 DCHECK(!for_websockets_);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 factory_dump->AddScalar("main_job_count", 394 factory_dump->AddScalar("main_job_count",
373 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 395 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
374 main_job_count); 396 main_job_count);
375 // The number of preconnect controllers. 397 // The number of preconnect controllers.
376 factory_dump->AddScalar("preconnect_count", 398 factory_dump->AddScalar("preconnect_count",
377 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 399 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
378 preconnect_controller_count); 400 preconnect_controller_count);
379 } 401 }
380 402
381 } // namespace net 403 } // namespace net
OLDNEW
« 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