Chromium Code Reviews| Index: net/http/http_stream_factory_impl.cc |
| diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc |
| index 577a990853ae6ac0e4d83987152c46b7873ee019..653f6c41f91abd0fea22d2560a9e17138e3bf563 100644 |
| --- a/net/http/http_stream_factory_impl.cc |
| +++ b/net/http/http_stream_factory_impl.cc |
| @@ -11,6 +11,10 @@ |
| #include "base/metrics/histogram_macros.h" |
| #include "base/stl_util.h" |
| #include "base/strings/string_util.h" |
| +#include "base/strings/stringprintf.h" |
| +#include "base/trace_event/memory_allocator_dump.h" |
| +#include "base/trace_event/memory_usage_estimator.h" |
| +#include "base/trace_event/process_memory_dump.h" |
| #include "net/http/http_network_session.h" |
| #include "net/http/http_server_properties.h" |
| #include "net/http/http_stream_factory_impl_job.h" |
| @@ -302,4 +306,41 @@ bool HttpStreamFactoryImpl::ProxyServerSupportsPriorities( |
| scheme_host_port); |
| } |
| +void HttpStreamFactoryImpl::DumpMemoryStats( |
| + base::trace_event::ProcessMemoryDump* pmd, |
| + const std::string& parent_absolute_name) const { |
| + std::string name = |
| + base::StringPrintf("%s/stream_factory", parent_absolute_name.c_str()); |
| + base::trace_event::MemoryAllocatorDump* factory_dump = |
| + pmd->CreateAllocatorDump(name); |
| + size_t alt_job_count = 0; |
| + size_t main_job_count = 0; |
| + size_t preconnect_controller_count = 0; |
| + for (const auto& it : job_controller_set_) { |
| + if (it->HasPendingAltJob()) |
| + alt_job_count++; |
| + if (it->HasPendingMainJob()) |
| + 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.
|
| + if (it->is_preconnect()) |
| + preconnect_controller_count++; |
| + } |
| + factory_dump->AddScalar( |
| + base::trace_event::MemoryAllocatorDump::kNameSize, |
| + base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| + base::trace_event::EstimateMemoryUsage(job_controller_set_)); |
| + factory_dump->AddScalar( |
| + base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
| + base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| + job_controller_set_.size()); |
| + factory_dump->AddScalar("alt_job_count", |
| + base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| + alt_job_count); |
| + factory_dump->AddScalar("main_job_count", |
| + base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| + main_job_count); |
| + factory_dump->AddScalar("preconnect_count", |
| + base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| + preconnect_controller_count); |
| +} |
| + |
| } // namespace net |