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

Unified Diff: components/sync/syncable/directory.cc

Issue 2651563004: [sync] Add model type counters to memory dumps. (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/syncable/directory.cc
diff --git a/components/sync/syncable/directory.cc b/components/sync/syncable/directory.cc
index d8f708ed8defdb504e69e9f886c3b6bc8e2fa265..981e2e42c47dd463d7e236fde29575f22b6b4a1b 100644
--- a/components/sync/syncable/directory.cc
+++ b/components/sync/syncable/directory.cc
@@ -919,6 +919,7 @@ void Directory::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) {
base::StringPrintf("sync/0x%" PRIXPTR, reinterpret_cast<uintptr_t>(this));
size_t kernel_memory_usage;
+ size_t model_type_entry_count[MODEL_TYPE_COUNT] = {0};
{
using base::trace_event::EstimateMemoryUsage;
@@ -938,6 +939,31 @@ void Directory::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) {
EstimateMemoryUsage(kernel_->metahandles_to_purge) +
EstimateMemoryUsage(kernel_->persisted_info) +
EstimateMemoryUsage(kernel_->cache_guid);
+
+ for (const auto& handle_and_kernel : kernel_->metahandles_map) {
+ const EntryKernel* kernel = handle_and_kernel.second.get();
+ // Counting logic from DirectoryBackingStore::LoadEntries()
+ ModelType model_type = kernel->GetModelType();
+ if (!IsRealDataType(model_type)) {
+ model_type = kernel->GetServerModelType();
+ }
+ ++model_type_entry_count[model_type];
+ }
+ }
+
+ // Similar to UploadModelTypeEntryCount()
+ for (size_t i = FIRST_REAL_MODEL_TYPE; i != MODEL_TYPE_COUNT; ++i) {
+ ModelType model_type = static_cast<ModelType>(i);
+ std::string notification_type;
+ if (RealModelTypeToNotificationType(model_type, &notification_type)) {
+ std::string dump_name =
+ base::StringPrintf("%s/model_type/%s", dump_name_base.c_str(),
+ notification_type.c_str());
+ pmd->CreateAllocatorDump(dump_name)->AddScalar(
+ base::trace_event::MemoryAllocatorDump::kNameObjectCount,
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ model_type_entry_count[i]);
+ }
}
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698