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

Unified Diff: net/disk_cache/memory/mem_backend_impl.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/memory/mem_backend_impl.h ('k') | net/disk_cache/simple/simple_backend_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/memory/mem_backend_impl.cc
diff --git a/net/disk_cache/memory/mem_backend_impl.cc b/net/disk_cache/memory/mem_backend_impl.cc
index 65e14d71686da03b3c1fd36b58a91024837f4cb1..a7ad28b8d8d1e163aae095faa569e119e91bb864 100644
--- a/net/disk_cache/memory/mem_backend_impl.cc
+++ b/net/disk_cache/memory/mem_backend_impl.cc
@@ -12,6 +12,7 @@
#include "base/memory/ptr_util.h"
#include "base/sys_info.h"
#include "base/trace_event/memory_usage_estimator.h"
+#include "base/trace_event/process_memory_dump.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/memory/mem_entry_impl.h"
@@ -284,11 +285,25 @@ void MemBackendImpl::OnExternalCacheHit(const std::string& key) {
it->second->UpdateStateOnUse(MemEntryImpl::ENTRY_WAS_NOT_MODIFIED);
}
-size_t MemBackendImpl::EstimateMemoryUsage() const {
+size_t MemBackendImpl::DumpMemoryStats(
+ base::trace_event::ProcessMemoryDump* pmd,
+ const std::string& parent_absolute_name) const {
+ base::trace_event::MemoryAllocatorDump* dump =
+ pmd->CreateAllocatorDump(parent_absolute_name + "/memory_backend");
+
// Entries in lru_list_ will be counted by EMU but not in entries_ since
// they're pointers.
- return base::trace_event::EstimateMemoryUsage(lru_list_) +
- base::trace_event::EstimateMemoryUsage(entries_);
+ size_t size = base::trace_event::EstimateMemoryUsage(lru_list_) +
+ base::trace_event::EstimateMemoryUsage(entries_);
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, size);
+ dump->AddScalar("mem_backend_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ current_size_);
+ dump->AddScalar("mem_backend_max_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ max_size_);
+ return size;
}
void MemBackendImpl::EvictIfNeeded() {
« no previous file with comments | « net/disk_cache/memory/mem_backend_impl.h ('k') | net/disk_cache/simple/simple_backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698