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..2f8938a4459bac8f989b95b0b80923df684fc3aa 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,48 @@ 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_) { |
| + // For a preconnect controller, it should have exactly the main job. |
| + if (it->is_preconnect()) { |
| + preconnect_controller_count++; |
| + continue; |
| + } |
| + // For non-preconnects. |
| + if (it->HasPendingAltJob()) |
| + alt_job_count++; |
| + if (it->HasPendingMainJob()) |
| + main_job_count++; |
|
ssid
2017/01/18 23:51:52
I think this was already discussed. Just making su
xunjieli
2017/01/19 14:50:42
I also logged the total size of |job_controller_se
ssid
2017/01/20 20:20:23
Ah okay thanks.
|
| + } |
| + 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()); |
| + // The number of non-preconnect controllers with a pending alt job. |
| + factory_dump->AddScalar("alt_job_count", |
| + base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| + alt_job_count); |
| + // The number of non-preconnect controllers with a pending main job. |
| + factory_dump->AddScalar("main_job_count", |
| + base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| + main_job_count); |
| + // The number of preconnect controllers. |
| + factory_dump->AddScalar("preconnect_count", |
| + base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| + preconnect_controller_count); |
| +} |
| + |
| } // namespace net |