| Index: third_party/tcmalloc/chromium/src/deep-heap-profile.h
|
| diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.h b/third_party/tcmalloc/chromium/src/deep-heap-profile.h
|
| index 6638d32010df4f560dfc50507b7529d3bb34d777..4c65af12e95ecff89e5d2e11e4774318c83735e3 100644
|
| --- a/third_party/tcmalloc/chromium/src/deep-heap-profile.h
|
| +++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.h
|
| @@ -40,6 +40,31 @@ class DeepHeapProfile {
|
| typedef HeapProfileTable::AllocValue AllocValue;
|
| typedef HeapProfileTable::Stats Stats;
|
|
|
| + enum MapsRegionType {
|
| + // Bytes of memory which were not recognized with /proc/<pid>/maps.
|
| + // This size should be 0.
|
| + ABSENT,
|
| +
|
| + // Bytes of memory which is mapped anonymously.
|
| + // Regions which contain nothing in the last column of /proc/<pid>/maps.
|
| + ANONYMOUS,
|
| +
|
| + // Bytes of memory which is mapped to a executable/non-executable file.
|
| + // Regions which contain file paths in the last column of /proc/<pid>/maps.
|
| + FILE_EXEC,
|
| + FILE_NONEXEC,
|
| +
|
| + // Bytes of memory which is labeled [stack] in /proc/<pid>/maps.
|
| + STACK,
|
| +
|
| + // Bytes of memory which is labeled, but not mapped to any file.
|
| + // Regions which contain non-path strings in the last column of
|
| + // /proc/<pid>/maps.
|
| + OTHER,
|
| +
|
| + NUMBER_OF_MAPS_REGION_TYPES
|
| + };
|
| +
|
| // Construct a DeepHeapProfile instance. It works as a wrapper of
|
| // HeapProfileTable.
|
| //
|
| @@ -79,7 +104,7 @@ class DeepHeapProfile {
|
|
|
| class RegionStats {
|
| public:
|
| - RegionStats() {}
|
| + RegionStats(): virtual_bytes_(0), committed_bytes_(0) {}
|
| ~RegionStats() {}
|
|
|
| // Initialize virtual_bytes and committed_bytes.
|
| @@ -104,6 +129,10 @@ class DeepHeapProfile {
|
| void AddToCommittedBytes(size_t additional_committed_bytes) {
|
| committed_bytes_ += additional_committed_bytes;
|
| }
|
| + void AddAnotherRegionStat(const RegionStats& other) {
|
| + virtual_bytes_ += other.virtual_bytes_;
|
| + committed_bytes_ += other.committed_bytes_;
|
| + }
|
|
|
| private:
|
| size_t virtual_bytes_;
|
| @@ -116,28 +145,20 @@ class DeepHeapProfile {
|
| // memory and committed memory.
|
| // TODO(dmikurube): These regions should be classified more precisely later
|
| // for more detailed analysis.
|
| -
|
| - // Total bytes of the process memory.
|
| - RegionStats total;
|
| -
|
| - // Total bytes of memory which is mapped to a file.
|
| - // Regions which contain file paths in the last column of /proc/<pid>/maps.
|
| - RegionStats file_mapped;
|
| -
|
| - // Total bytes of memory which is mapped anonymously.
|
| - // Regions which contain nothing in the last column of /proc/<pid>/maps.
|
| - RegionStats anonymous;
|
| -
|
| - // Total bytes of memory which is labeled, but not mapped to any file.
|
| - // Regions which contain non-path strings in the last column of
|
| - // /proc/<pid>/maps.
|
| - RegionStats other;
|
| + RegionStats all[NUMBER_OF_MAPS_REGION_TYPES];
|
| + RegionStats nonprofiled[NUMBER_OF_MAPS_REGION_TYPES];
|
|
|
| // Total bytes of mmap'ed regions.
|
| - RegionStats record_mmap;
|
| + RegionStats profiled_mmap;
|
|
|
| // Total bytes of malloc'ed regions.
|
| - RegionStats record_malloc;
|
| + RegionStats profiled_malloc;
|
| + };
|
| +
|
| + struct MMapListEntry {
|
| + uint64 first_address;
|
| + uint64 last_address;
|
| + MapsRegionType type;
|
| };
|
|
|
| // Checks if the length of |printed| characters by snprintf is valid.
|
| @@ -178,7 +199,9 @@ class DeepHeapProfile {
|
| // Compute the global statistics from /proc/self/maps and |pagemap_fd|, and
|
| // store the statistics in |stats|.
|
| static void SnapshotGlobalStatsWithoutMalloc(int pagemap_fd,
|
| - GlobalStats* stats);
|
| + GlobalStats* stats,
|
| + MMapListEntry* mmap_list,
|
| + int mmap_list_length);
|
|
|
| // Get the DeepBucket object corresponding to the given |bucket|.
|
| // DeepBucket is an extension to Bucket which is declared above.
|
| @@ -195,6 +218,14 @@ class DeepHeapProfile {
|
| int buffer_size,
|
| char buffer[]);
|
|
|
| + static bool ByFirstAddress(const MMapListEntry& a,
|
| + const MMapListEntry& b);
|
| +
|
| + // Count mmap allocations in deep_profile->num_mmap_allocations_.
|
| + static void CountMMap(const void* pointer,
|
| + AllocValue* alloc_value,
|
| + DeepHeapProfile* deep_profile);
|
| +
|
| // Record both virtual and committed byte counts of malloc and mmap regions
|
| // as callback functions for AllocationMap::Iterate().
|
| static void RecordAlloc(const void* pointer,
|
| @@ -248,6 +279,9 @@ class DeepHeapProfile {
|
|
|
| int bucket_id_;
|
| DeepBucketMap* deep_bucket_map_;
|
| + MMapListEntry* mmap_list_;
|
| + int mmap_list_length_;
|
| + int num_mmap_allocations_;
|
| #endif // DEEP_HEAP_PROFILE
|
|
|
| HeapProfileTable* heap_profile_;
|
|
|