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

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: 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;
110 for (const auto& it : job_controller_set_) {
111 // For a preconnect controller, it should have exactly the main job.
112 if (it->is_preconnect()) {
113 preconnect_controller_count++;
114 continue;
115 }
116 // For non-preconnects.
xunjieli 2017/03/17 00:47:56 Suggest add a DCHECK(it->HasPendingAltJob()||it->H
Zhongyi Shi 2017/03/17 02:02:29 Done.
117 if (it->HasPendingAltJob())
118 alt_job_count++;
119 if (it->HasPendingMainJob())
120 main_job_count++;
121 }
122 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobController",
xunjieli 2017/03/17 00:47:56 This histogram is not necessary, right? We can ded
Zhongyi Shi 2017/03/17 02:02:29 Well, that's not exactly true. There might be JobC
xunjieli 2017/03/17 13:05:23 Right, that's why I suggested using a DCHECK(it->H
123 job_controller_set_.size());
124 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfPreconnect",
125 preconnect_controller_count);
126 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfAltJob", alt_job_count);
xunjieli 2017/03/17 00:47:56 For someone who might not know this code, I sugges
Zhongyi Shi 2017/03/17 02:02:29 Done.
127 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfMainJob",
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