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

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

Issue 2815153002: Only log the job controller count when it's hitting boundaries for the first time (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 alternative_proxy_server, enable_ip_based_pooling, net_log); 96 alternative_proxy_server, enable_ip_based_pooling, net_log);
97 } 97 }
98 }; 98 };
99 99
100 } // anonymous namespace 100 } // anonymous namespace
101 101
102 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, 102 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session,
103 bool for_websockets) 103 bool for_websockets)
104 : session_(session), 104 : session_(session),
105 job_factory_(new DefaultJobFactory()), 105 job_factory_(new DefaultJobFactory()),
106 for_websockets_(for_websockets) {} 106 for_websockets_(for_websockets),
107 last_logged_job_controller_count_(0) {}
107 108
108 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() { 109 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() {
109 DCHECK(spdy_session_request_map_.empty()); 110 DCHECK(spdy_session_request_map_.empty());
110 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobControllerAtShutDown", 111 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobControllerAtShutDown",
111 job_controller_set_.size()); 112 job_controller_set_.size());
112 } 113 }
113 114
114 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( 115 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream(
115 const HttpRequestInfo& request_info, 116 const HttpRequestInfo& request_info,
116 RequestPriority priority, 117 RequestPriority priority,
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 HostPortPair host_port_pair = proxy_info.proxy_server().host_port_pair(); 350 HostPortPair host_port_pair = proxy_info.proxy_server().host_port_pair();
350 DCHECK(!host_port_pair.IsEmpty()); 351 DCHECK(!host_port_pair.IsEmpty());
351 352
352 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(), 353 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(),
353 host_port_pair.port()); 354 host_port_pair.port());
354 355
355 return session_->http_server_properties()->SupportsRequestPriority( 356 return session_->http_server_properties()->SupportsRequestPriority(
356 scheme_host_port); 357 scheme_host_port);
357 } 358 }
358 359
359 void HttpStreamFactoryImpl::AddJobControllerCountToHistograms() const { 360 void HttpStreamFactoryImpl::AddJobControllerCountToHistograms() {
360 // Only log the count of JobControllers when the count is hitting one of the 361 // Only log the count of JobControllers when the count is hitting one of the
361 // boundaries which is a multiple of 100: 100, 200, 300, etc. 362 // boundaries for the first time which is a multiple of 100: 100, 200, 300,
362 if (job_controller_set_.size() < 100 || job_controller_set_.size() % 100 != 0) 363 // etc.
364 if (job_controller_set_.size() % 100 != 0 ||
365 job_controller_set_.size() <= last_logged_job_controller_count_)
363 return; 366 return;
Ryan Hamilton 2017/04/12 21:05:53 nit: now that the predicate is more than one line,
Zhongyi Shi 2017/04/12 21:18:04 Done.
367 last_logged_job_controller_count_ = job_controller_set_.size();
364 368
365 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobController", 369 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobController",
366 job_controller_set_.size()); 370 job_controller_set_.size());
367 371
368 int alt_job_count = 0; 372 int alt_job_count = 0;
369 int main_job_count = 0; 373 int main_job_count = 0;
370 int preconnect_controller_count = 0; 374 int preconnect_controller_count = 0;
371 for (const auto& job_controller : job_controller_set_) { 375 for (const auto& job_controller : job_controller_set_) {
372 DCHECK(job_controller->HasPendingAltJob() || 376 DCHECK(job_controller->HasPendingAltJob() ||
373 job_controller->HasPendingMainJob()); 377 job_controller->HasPendingMainJob());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 factory_dump->AddScalar("main_job_count", 434 factory_dump->AddScalar("main_job_count",
431 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 435 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
432 main_job_count); 436 main_job_count);
433 // The number of preconnect controllers. 437 // The number of preconnect controllers.
434 factory_dump->AddScalar("preconnect_count", 438 factory_dump->AddScalar("preconnect_count",
435 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 439 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
436 preconnect_controller_count); 440 preconnect_controller_count);
437 } 441 }
438 442
439 } // namespace net 443 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698