summaryrefslogtreecommitdiffstats
path: root/third_party/tcmalloc
diff options
context:
space:
mode:
authordmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 07:28:36 +0000
committerdmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 07:28:36 +0000
commit95f2d204098eb38e086500f1707f20ae2e5b4ef6 (patch)
tree52b6ff85b1d16470c485f1a51182957c947a4815 /third_party/tcmalloc
parenta4bbc1f9b821dee29561beb13bc8d42eadfb0f6a (diff)
downloadchromium_src-95f2d204098eb38e086500f1707f20ae2e5b4ef6.zip
chromium_src-95f2d204098eb38e086500f1707f20ae2e5b4ef6.tar.gz
chromium_src-95f2d204098eb38e086500f1707f20ae2e5b4ef6.tar.bz2
Verify that total committed memory in VMA is correct in deep-heap-profile.
BUG=245603 R=glider@chromium.org Review URL: https://codereview.chromium.org/16073009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc')
-rw-r--r--third_party/tcmalloc/chromium/src/deep-heap-profile.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
index 5e58941..8c0128a 100644
--- a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
+++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
@@ -699,6 +699,8 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
continue; // Reading pagemap will fail in [vsyscall].
}
+ // TODO(dmikurube): |type| will be deprecated in the dump.
+ // See http://crbug.com/245603.
type = ABSENT;
if (filename[0] == '/') {
if (flags[2] == 'x')
@@ -712,10 +714,14 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
} else {
type = OTHER;
}
- all_[type].Record(
+ // TODO(dmikurube): This |all_| count should be removed in future soon.
+ // See http://crbug.com/245603.
+ uint64 vma_total = all_[type].Record(
memory_residence_info_getter, vma_start_addr, vma_last_addr);
+ uint64 vma_subtotal = 0;
// TODO(dmikurube): Stop double-counting pagemap.
+ // It will be fixed when http://crbug.com/245603 finishes.
if (MemoryRegionMap::IsRecordingLocked()) {
uint64 cursor = vma_start_addr;
bool first = true;
@@ -752,6 +758,7 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
memory_residence_info_getter,
cursor,
last_address_of_unhooked);
+ vma_subtotal += committed_size;
if (mmap_dump_buffer) {
mmap_dump_buffer->AppendString(" ", 0);
mmap_dump_buffer->AppendPtr(cursor, 0);
@@ -783,6 +790,7 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
partial_last_address = mmap_iter->end_addr - 1;
uint64 committed_size = memory_residence_info_getter->CommittedSize(
partial_first_address, partial_last_address);
+ vma_subtotal += committed_size;
mmap_dump_buffer->AppendString(trailing ? " (" : " ", 0);
mmap_dump_buffer->AppendPtr(mmap_iter->start_addr, 0);
mmap_dump_buffer->AppendString(trailing ? ")" : " ", 0);
@@ -806,6 +814,16 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
} while (mmap_iter != MemoryRegionMap::EndRegionLocked() &&
mmap_iter->end_addr - 1 <= vma_last_addr);
}
+
+ if (vma_total != vma_subtotal) {
+ char buffer[1024];
+ int written = procmaps_iter.FormatLine(buffer, sizeof(buffer),
+ vma_start_addr, vma_last_addr,
+ flags, offset, inode, filename, 0);
+ RAW_LOG(0, "[%d] Mismatched total in VMA %"PRId64":%"PRId64" (%"PRId64")",
+ getpid(), vma_total, vma_subtotal, vma_total - vma_subtotal);
+ RAW_LOG(0, "[%d] in %s", getpid(), buffer);
+ }
}
// TODO(dmikurube): Investigate and fix http://crbug.com/189114.
@@ -819,6 +837,8 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
// during counting memory usage in the loop above.
//
// The difference is accounted as "ABSENT" to investigate such cases.
+ //
+ // It will be fixed when http://crbug.com/245603 finishes (no double count).
RegionStats all_total;
RegionStats unhooked_total;