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

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

Issue 2623383005: Log states of JobController in Net MemoryDumpProvider (Closed)
Patch Set: add a pending main job count Created 3 years, 11 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') | net/http/http_stream_factory_impl_job.h » ('j') | 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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h"
15 #include "base/trace_event/memory_allocator_dump.h"
16 #include "base/trace_event/memory_usage_estimator.h"
17 #include "base/trace_event/process_memory_dump.h"
14 #include "net/http/http_network_session.h" 18 #include "net/http/http_network_session.h"
15 #include "net/http/http_server_properties.h" 19 #include "net/http/http_server_properties.h"
16 #include "net/http/http_stream_factory_impl_job.h" 20 #include "net/http/http_stream_factory_impl_job.h"
17 #include "net/http/http_stream_factory_impl_job_controller.h" 21 #include "net/http/http_stream_factory_impl_job_controller.h"
18 #include "net/http/http_stream_factory_impl_request.h" 22 #include "net/http/http_stream_factory_impl_request.h"
19 #include "net/http/transport_security_state.h" 23 #include "net/http/transport_security_state.h"
20 #include "net/proxy/proxy_info.h" 24 #include "net/proxy/proxy_info.h"
21 #include "net/quic/core/quic_server_id.h" 25 #include "net/quic/core/quic_server_id.h"
22 #include "net/spdy/bidirectional_stream_spdy_impl.h" 26 #include "net/spdy/bidirectional_stream_spdy_impl.h"
23 #include "net/spdy/spdy_http_stream.h" 27 #include "net/spdy/spdy_http_stream.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 HostPortPair host_port_pair = proxy_info.proxy_server().host_port_pair(); 299 HostPortPair host_port_pair = proxy_info.proxy_server().host_port_pair();
296 DCHECK(!host_port_pair.IsEmpty()); 300 DCHECK(!host_port_pair.IsEmpty());
297 301
298 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(), 302 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(),
299 host_port_pair.port()); 303 host_port_pair.port());
300 304
301 return session_->http_server_properties()->SupportsRequestPriority( 305 return session_->http_server_properties()->SupportsRequestPriority(
302 scheme_host_port); 306 scheme_host_port);
303 } 307 }
304 308
309 void HttpStreamFactoryImpl::DumpMemoryStats(
310 base::trace_event::ProcessMemoryDump* pmd,
311 const std::string& parent_absolute_name) const {
312 std::string name =
313 base::StringPrintf("%s/stream_factory", parent_absolute_name.c_str());
314 base::trace_event::MemoryAllocatorDump* factory_dump =
315 pmd->CreateAllocatorDump(name);
316 size_t alt_job_count = 0;
317 size_t main_job_count = 0;
318 size_t preconnect_controller_count = 0;
319 for (const auto& it : job_controller_set_) {
320 if (it->HasPendingAltJob())
321 alt_job_count++;
322 if (it->HasPendingMainJob())
323 main_job_count++;
Zhongyi Shi 2017/01/18 20:39:32 nit: preconnect jobcontrollers will only have main
xunjieli 2017/01/18 20:56:57 Done.
324 if (it->is_preconnect())
325 preconnect_controller_count++;
326 }
327 factory_dump->AddScalar(
328 base::trace_event::MemoryAllocatorDump::kNameSize,
329 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
330 base::trace_event::EstimateMemoryUsage(job_controller_set_));
331 factory_dump->AddScalar(
332 base::trace_event::MemoryAllocatorDump::kNameObjectCount,
333 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
334 job_controller_set_.size());
335 factory_dump->AddScalar("alt_job_count",
336 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
337 alt_job_count);
338 factory_dump->AddScalar("main_job_count",
339 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
340 main_job_count);
341 factory_dump->AddScalar("preconnect_count",
342 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
343 preconnect_controller_count);
344 }
345
305 } // namespace net 346 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/http_stream_factory_impl_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698