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

Unified Diff: net/http/http_stream_factory_impl.cc

Issue 2623383005: Log states of JobController in Net MemoryDumpProvider (Closed)
Patch Set: self review 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0c525e14d819794f6b15414039fd3e3962b64f01 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,50 @@ bool HttpStreamFactoryImpl::ProxyServerSupportsPriorities(
scheme_host_port);
}
+void HttpStreamFactoryImpl::DumpMemoryStats(
+ base::trace_event::ProcessMemoryDump* pmd,
+ const std::string& parent_absolute_name) const {
+ if (job_controller_set_.empty())
+ return;
+ 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++;
+ }
+ 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
« 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