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

Unified Diff: net/spdy/spdy_session_pool.cc

Issue 2623803002: Avoid creating MemoryAllocatorDump for individual sockets (Closed)
Patch Set: Address Eric's comments 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/spdy/spdy_session.cc ('k') | net/spdy/spdy_session_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_pool.cc
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 904edae945cb90cded6fa377f38bc55c41f441af..1892ed4b20e6f5f2ac0cb2c10f0a6b1e67d52354 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -372,10 +372,42 @@ void SpdySessionPool::DumpMemoryStats(
const std::string& parent_dump_absolute_name) const {
std::string dump_name = base::StringPrintf("%s/spdy_session_pool",
parent_dump_absolute_name.c_str());
- pmd->CreateAllocatorDump(dump_name);
+ base::trace_event::MemoryAllocatorDump* dump =
+ pmd->CreateAllocatorDump(dump_name);
+ size_t total_size = 0;
+ size_t buffer_size = 0;
+ size_t cert_count = 0;
+ size_t serialized_cert_size = 0;
+ size_t num_active_sessions = 0;
for (const auto& session : sessions_) {
- session->DumpMemoryStats(pmd, dump_name);
+ StreamSocket::SocketMemoryStats stats;
+ bool is_session_active = false;
+ session->DumpMemoryStats(&stats, &is_session_active);
+ total_size += stats.total_size;
+ buffer_size += stats.buffer_size;
+ cert_count += stats.cert_count;
+ serialized_cert_size += stats.serialized_cert_size;
+ if (is_session_active)
+ num_active_sessions++;
}
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ total_size);
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ sessions_.size());
+ dump->AddScalar("active_session_count",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ num_active_sessions);
+ dump->AddScalar("buffer_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ buffer_size);
+ dump->AddScalar("cert_count",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ cert_count);
+ dump->AddScalar("serialized_cert_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ serialized_cert_size);
}
bool SpdySessionPool::IsSessionAvailable(
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_session_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698