OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // --- | 5 // --- |
6 // Author: Sainbayar Sukhbaatar | 6 // Author: Sainbayar Sukhbaatar |
7 // Dai Mikurube | 7 // Dai Mikurube |
8 // | 8 // |
9 // This file contains a class DeepHeapProfile and its public function | 9 // This file contains a class DeepHeapProfile and its public function |
10 // DeepHeapProfile::FillOrderedProfile() which works as an alternative of | 10 // DeepHeapProfile::FillOrderedProfile() which works as an alternative of |
(...skipping 19 matching lines...) Expand all Loading... |
30 #ifndef BASE_DEEP_HEAP_PROFILE_H_ | 30 #ifndef BASE_DEEP_HEAP_PROFILE_H_ |
31 #define BASE_DEEP_HEAP_PROFILE_H_ | 31 #define BASE_DEEP_HEAP_PROFILE_H_ |
32 | 32 |
33 #include "config.h" | 33 #include "config.h" |
34 | 34 |
35 #if defined(TYPE_PROFILING) | 35 #if defined(TYPE_PROFILING) |
36 #include <typeinfo> | 36 #include <typeinfo> |
37 #endif | 37 #endif |
38 | 38 |
39 #if defined(__linux__) | 39 #if defined(__linux__) |
40 #define DEEP_HEAP_PROFILE 1 | 40 #define USE_DEEP_HEAP_PROFILE 1 |
41 #endif | 41 #endif |
42 | 42 |
43 #include "addressmap-inl.h" | 43 #include "addressmap-inl.h" |
44 #include "heap-profile-table.h" | 44 #include "heap-profile-table.h" |
45 #include "memory_region_map.h" | 45 #include "memory_region_map.h" |
46 | 46 |
47 class DeepHeapProfile { | 47 class DeepHeapProfile { |
48 public: | 48 public: |
49 // Defines an interface for getting info about memory residence. | 49 // Defines an interface for getting info about memory residence. |
50 class MemoryResidenceInfoGetterInterface { | 50 class MemoryResidenceInfoGetterInterface { |
(...skipping 28 matching lines...) Expand all Loading... |
79 // Fills deep profile dump into |raw_buffer| of |buffer_size|, and return the | 79 // Fills deep profile dump into |raw_buffer| of |buffer_size|, and return the |
80 // actual size occupied by the dump in |raw_buffer|. It works as an | 80 // actual size occupied by the dump in |raw_buffer|. It works as an |
81 // alternative of HeapProfileTable::FillOrderedProfile. |raw_buffer| is not | 81 // alternative of HeapProfileTable::FillOrderedProfile. |raw_buffer| is not |
82 // terminated by zero. | 82 // terminated by zero. |
83 // | 83 // |
84 // In addition, a list of buckets is dumped into a ".buckets" file in | 84 // In addition, a list of buckets is dumped into a ".buckets" file in |
85 // descending order of allocated bytes. | 85 // descending order of allocated bytes. |
86 int FillOrderedProfile(char raw_buffer[], int buffer_size); | 86 int FillOrderedProfile(char raw_buffer[], int buffer_size); |
87 | 87 |
88 private: | 88 private: |
89 #ifdef DEEP_HEAP_PROFILE | 89 #ifdef USE_DEEP_HEAP_PROFILE |
90 typedef HeapProfileTable::Stats Stats; | 90 typedef HeapProfileTable::Stats Stats; |
91 typedef HeapProfileTable::Bucket Bucket; | 91 typedef HeapProfileTable::Bucket Bucket; |
92 typedef HeapProfileTable::AllocValue AllocValue; | 92 typedef HeapProfileTable::AllocValue AllocValue; |
93 typedef HeapProfileTable::AllocationMap AllocationMap; | 93 typedef HeapProfileTable::AllocationMap AllocationMap; |
94 | 94 |
95 enum MapsRegionType { | 95 enum MapsRegionType { |
96 // Bytes of memory which were not recognized with /proc/<pid>/maps. | 96 // Bytes of memory which were not recognized with /proc/<pid>/maps. |
97 // This size should be 0. | 97 // This size should be 0. |
98 ABSENT, | 98 ABSENT, |
99 | 99 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 // Process ID of the last dump. This can change by fork. | 302 // Process ID of the last dump. This can change by fork. |
303 pid_t most_recent_pid_; | 303 pid_t most_recent_pid_; |
304 | 304 |
305 GlobalStats stats_; // Stats about total memory. | 305 GlobalStats stats_; // Stats about total memory. |
306 int dump_count_; // The number of dumps. | 306 int dump_count_; // The number of dumps. |
307 char* filename_prefix_; // Output file prefix. | 307 char* filename_prefix_; // Output file prefix. |
308 char* profiler_buffer_; // Buffer we use many times. | 308 char* profiler_buffer_; // Buffer we use many times. |
309 | 309 |
310 DeepBucketTable deep_table_; | 310 DeepBucketTable deep_table_; |
311 #endif // DEEP_HEAP_PROFILE | 311 #endif // USE_DEEP_HEAP_PROFILE |
312 | 312 |
313 HeapProfileTable* heap_profile_; | 313 HeapProfileTable* heap_profile_; |
314 | 314 |
315 DISALLOW_COPY_AND_ASSIGN(DeepHeapProfile); | 315 DISALLOW_COPY_AND_ASSIGN(DeepHeapProfile); |
316 }; | 316 }; |
317 | 317 |
318 #endif // BASE_DEEP_HEAP_PROFILE_H_ | 318 #endif // BASE_DEEP_HEAP_PROFILE_H_ |
OLD | NEW |