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 24 matching lines...) Expand all Loading... |
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 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 | 46 |
46 class DeepHeapProfile { | 47 class DeepHeapProfile { |
47 public: | 48 public: |
48 // Defines an interface for getting info about memory residence. | 49 // Defines an interface for getting info about memory residence. |
49 class MemoryResidenceInfoGetterInterface { | 50 class MemoryResidenceInfoGetterInterface { |
50 public: | 51 public: |
51 virtual ~MemoryResidenceInfoGetterInterface(); | 52 virtual ~MemoryResidenceInfoGetterInterface(); |
52 | 53 |
53 // Initializes the instance. | 54 // Initializes the instance. |
54 virtual void Initialize() = 0; | 55 virtual void Initialize() = 0; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // Writes global stats into |buffer|. | 264 // Writes global stats into |buffer|. |
264 void Unparse(TextBuffer* buffer); | 265 void Unparse(TextBuffer* buffer); |
265 | 266 |
266 private: | 267 private: |
267 // Records both virtual and committed byte counts of malloc and mmap regions | 268 // Records both virtual and committed byte counts of malloc and mmap regions |
268 // as callback functions for AllocationMap::Iterate(). | 269 // as callback functions for AllocationMap::Iterate(). |
269 static void RecordAlloc(const void* pointer, | 270 static void RecordAlloc(const void* pointer, |
270 AllocValue* alloc_value, | 271 AllocValue* alloc_value, |
271 DeepHeapProfile* deep_profile); | 272 DeepHeapProfile* deep_profile); |
272 | 273 |
| 274 DeepBucket* GetInformationOfMemoryRegion( |
| 275 const MemoryRegionMap::RegionIterator& mmap_iter, |
| 276 const MemoryResidenceInfoGetterInterface* memory_residence_info_getter, |
| 277 DeepHeapProfile* deep_profile); |
| 278 |
273 // All RegionStats members in this class contain the bytes of virtual | 279 // All RegionStats members in this class contain the bytes of virtual |
274 // memory and committed memory. | 280 // memory and committed memory. |
275 // TODO(dmikurube): These regions should be classified more precisely later | 281 // TODO(dmikurube): These regions should be classified more precisely later |
276 // for more detailed analysis. | 282 // for more detailed analysis. |
277 RegionStats all_[NUMBER_OF_MAPS_REGION_TYPES]; | 283 RegionStats all_[NUMBER_OF_MAPS_REGION_TYPES]; |
278 | 284 |
279 RegionStats unhooked_[NUMBER_OF_MAPS_REGION_TYPES]; | 285 RegionStats unhooked_[NUMBER_OF_MAPS_REGION_TYPES]; |
280 | 286 |
281 // Total bytes of malloc'ed regions. | 287 // Total bytes of malloc'ed regions. |
282 RegionStats profiled_malloc_; | 288 RegionStats profiled_malloc_; |
(...skipping 20 matching lines...) Expand all Loading... |
303 | 309 |
304 DeepBucketTable deep_table_; | 310 DeepBucketTable deep_table_; |
305 #endif // DEEP_HEAP_PROFILE | 311 #endif // DEEP_HEAP_PROFILE |
306 | 312 |
307 HeapProfileTable* heap_profile_; | 313 HeapProfileTable* heap_profile_; |
308 | 314 |
309 DISALLOW_COPY_AND_ASSIGN(DeepHeapProfile); | 315 DISALLOW_COPY_AND_ASSIGN(DeepHeapProfile); |
310 }; | 316 }; |
311 | 317 |
312 #endif // BASE_DEEP_HEAP_PROFILE_H_ | 318 #endif // BASE_DEEP_HEAP_PROFILE_H_ |
OLD | NEW |