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

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: Whitelist strings 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
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..bae32910735483b79ac7f662a84567be7206ff19 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,29 @@ 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("phys_mem",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ base::SysInfo::AmountOfPhysicalMemory());
ssid 2017/03/27 18:59:42 Um, we already have this data from the crash serve
jkarlin 2017/03/28 15:09:45 I've removed it, but are you 100% certain that the
+ dump->AddScalar("cur_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
ssid 2017/03/27 18:59:42 I'd make these names as current_size and system_ph
jkarlin 2017/03/28 15:09:45 Done.
+ current_size_);
+ dump->AddScalar("max_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ max_size_);
+ return size;
}
void MemBackendImpl::EvictIfNeeded() {

Powered by Google App Engine
This is Rietveld 408576698