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

Unified Diff: net/quic/chromium/quic_stream_factory.cc

Issue 2807493002: Track STL containers in QuicStreamFactory::DumpMemoryStats (Closed)
Patch Set: address zhongyi@ comment Created 3 years, 8 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/quic/chromium/quic_stream_factory.h ('k') | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/quic_stream_factory.cc
diff --git a/net/quic/chromium/quic_stream_factory.cc b/net/quic/chromium/quic_stream_factory.cc
index 1fe0bf28f1878cae0695a69dfbbe1396be04291c..0c8cccc505b04c9502c1eb91250457154e1bccb4 100644
--- a/net/quic/chromium/quic_stream_factory.cc
+++ b/net/quic/chromium/quic_stream_factory.cc
@@ -67,6 +67,12 @@ using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle;
namespace net {
+// Returns the estimate of dynamically allocated memory of an IPEndPoint in
+// bytes. Used in tracking IPAliasMap.
+size_t EstimateMemoryUsage(const IPEndPoint& end_point) {
+ return 0;
+}
+
namespace {
enum CreateSessionFailure {
@@ -290,6 +296,12 @@ class QuicStreamFactory::CertVerifierJob {
const QuicServerId& server_id() const { return server_id_; }
+ size_t EstimateMemoryUsage() const {
+ // TODO(xunjieli): crbug.com/669108. Track |verify_context_| and
+ // |verify_details_|.
+ return base::trace_event::EstimateMemoryUsage(verify_error_details_);
+ }
+
private:
const QuicServerId server_id_;
ProofVerifierCallbackImpl* verify_callback_;
@@ -347,6 +359,9 @@ class QuicStreamFactory::Job {
base::WeakPtr<Job> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
+ // Returns the estimate of dynamically allocated memory in bytes.
+ size_t EstimateMemoryUsage() const;
+
private:
enum IoState {
STATE_NONE,
@@ -493,6 +508,11 @@ void QuicStreamFactory::Job::CancelWaitForDataReadyCallback() {
OnIOComplete(OK);
}
+size_t QuicStreamFactory::Job::EstimateMemoryUsage() const {
+ return base::trace_event::EstimateMemoryUsage(key_) +
+ base::trace_event::EstimateMemoryUsage(server_info_);
+}
+
int QuicStreamFactory::Job::DoResolveHost() {
dns_resolution_start_time_ = base::TimeTicks::Now();
// Start loading the data now, and wait for it after we resolve the host.
@@ -924,19 +944,32 @@ void QuicStreamFactory::set_quic_server_info_factory(
void QuicStreamFactory::DumpMemoryStats(
base::trace_event::ProcessMemoryDump* pmd,
const std::string& parent_absolute_name) const {
- if (all_sessions_.empty())
+ if (all_sessions_.empty() && active_jobs_.empty())
return;
base::trace_event::MemoryAllocatorDump* factory_dump =
pmd->CreateAllocatorDump(parent_absolute_name + "/quic_stream_factory");
size_t memory_estimate =
- base::trace_event::EstimateMemoryUsage(all_sessions_);
+ base::trace_event::EstimateMemoryUsage(all_sessions_) +
+ base::trace_event::EstimateMemoryUsage(active_sessions_) +
+ base::trace_event::EstimateMemoryUsage(session_aliases_) +
+ base::trace_event::EstimateMemoryUsage(ip_aliases_) +
+ base::trace_event::EstimateMemoryUsage(session_peer_ip_) +
+ base::trace_event::EstimateMemoryUsage(gone_away_aliases_) +
+ base::trace_event::EstimateMemoryUsage(active_jobs_) +
+ base::trace_event::EstimateMemoryUsage(job_requests_map_) +
+ base::trace_event::EstimateMemoryUsage(active_cert_verifier_jobs_);
factory_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
memory_estimate);
- factory_dump->AddScalar(
- base::trace_event::MemoryAllocatorDump::kNameObjectCount,
- base::trace_event::MemoryAllocatorDump::kUnitsObjects,
- all_sessions_.size());
+ factory_dump->AddScalar("all_sessions",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ all_sessions_.size());
+ factory_dump->AddScalar("active_jobs",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ active_jobs_.size());
+ factory_dump->AddScalar("active_cert_jobs",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ active_cert_verifier_jobs_.size());
}
bool QuicStreamFactory::CanUseExistingSession(const QuicServerId& server_id,
« no previous file with comments | « net/quic/chromium/quic_stream_factory.h ('k') | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698