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

Unified Diff: net/http/http_cache.cc

Issue 2779733002: [HttpCache] Store some memcache info to memory dumps for debugging (Closed)
Patch Set: Rebase xunjieli's change Created 3 years, 9 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/disk_cache/simple/simple_backend_impl.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.cc
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 1dc390a474c3abcc21e95539ed56ef75fb9dda16..bf423eccf48f79822767518d49828fc0e94c11e3 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -130,9 +130,9 @@ struct HttpCache::PendingOp {
// Returns the estimate of dynamically allocated memory in bytes.
size_t EstimateMemoryUsage() const {
- // |disk_entry| is tracked in |backend|.
- return base::trace_event::EstimateMemoryUsage(backend) +
- base::trace_event::EstimateMemoryUsage(writer) +
+ // Note that backend isn't counted because it doesn't provide an EMU
+ // function.
+ return base::trace_event::EstimateMemoryUsage(writer) +
base::trace_event::EstimateMemoryUsage(pending_queue);
}
@@ -512,16 +512,17 @@ void HttpCache::DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd,
const std::string& parent_absolute_name) const {
// Skip tracking members like |clock_| and |backend_factory_| because they
// don't allocate.
- base::trace_event::MemoryAllocatorDump* dump =
- pmd->CreateAllocatorDump(parent_absolute_name + "/http_cache");
- dump->AddScalar(
- base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- base::trace_event::EstimateMemoryUsage(disk_cache_) +
- base::trace_event::EstimateMemoryUsage(active_entries_) +
- base::trace_event::EstimateMemoryUsage(doomed_entries_) +
- base::trace_event::EstimateMemoryUsage(playback_cache_map_) +
- base::trace_event::EstimateMemoryUsage(pending_ops_));
+ std::string name = parent_absolute_name + "/http_cache";
+ base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(name);
+ size_t size = base::trace_event::EstimateMemoryUsage(active_entries_) +
+ base::trace_event::EstimateMemoryUsage(doomed_entries_) +
+ base::trace_event::EstimateMemoryUsage(playback_cache_map_) +
+ base::trace_event::EstimateMemoryUsage(pending_ops_);
+ if (disk_cache_)
+ size += disk_cache_->DumpMemoryStats(pmd, name);
+
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, size);
}
//-----------------------------------------------------------------------------
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/http/mock_http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698