| OLD | NEW |
| 1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 void IterateAllocationAddresses(AddressIterator, void* data); | 170 void IterateAllocationAddresses(AddressIterator, void* data); |
| 171 | 171 |
| 172 // Allocation context profile data iteration callback | 172 // Allocation context profile data iteration callback |
| 173 typedef void (*AllocContextIterator)(const AllocContextInfo& info); | 173 typedef void (*AllocContextIterator)(const AllocContextInfo& info); |
| 174 | 174 |
| 175 // Iterate over the allocation context profile data calling "callback" | 175 // Iterate over the allocation context profile data calling "callback" |
| 176 // for every allocation context. Allocation contexts are ordered by the | 176 // for every allocation context. Allocation contexts are ordered by the |
| 177 // size of allocated space. | 177 // size of allocated space. |
| 178 void IterateOrderedAllocContexts(AllocContextIterator callback) const; | 178 void IterateOrderedAllocContexts(AllocContextIterator callback) const; |
| 179 | 179 |
| 180 // Turn off generation of profile data from /proc/self/maps. This data is |
| 181 // not needed by profiles generated with pseudo-stacks. |
| 182 void DisableProfileSelfMaps(); |
| 183 |
| 180 // Fill profile data into buffer 'buf' of size 'size' | 184 // Fill profile data into buffer 'buf' of size 'size' |
| 181 // and return the actual size occupied by the dump in 'buf'. | 185 // and return the actual size occupied by the dump in 'buf'. |
| 182 // The profile buckets are dumped in the decreasing order | 186 // The profile buckets are dumped in the decreasing order |
| 183 // of currently allocated bytes. | 187 // of currently allocated bytes. |
| 184 // We do not provision for 0-terminating 'buf'. | 188 // We do not provision for 0-terminating 'buf'. |
| 185 int FillOrderedProfile(char buf[], int size) const; | 189 int FillOrderedProfile(char buf[], int size) const; |
| 186 | 190 |
| 187 // Cleanup any old profile files matching prefix + ".*" + kFileExt. | 191 // Cleanup any old profile files matching prefix + ".*" + kFileExt. |
| 188 static void CleanupOldProfiles(const char* prefix); | 192 static void CleanupOldProfiles(const char* prefix); |
| 189 | 193 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // Memory (de)allocator that we use. | 454 // Memory (de)allocator that we use. |
| 451 Allocator alloc_; | 455 Allocator alloc_; |
| 452 DeAllocator dealloc_; | 456 DeAllocator dealloc_; |
| 453 | 457 |
| 454 // Overall profile stats; we use only the Stats part, | 458 // Overall profile stats; we use only the Stats part, |
| 455 // but make it a Bucket to pass to UnparseBucket. | 459 // but make it a Bucket to pass to UnparseBucket. |
| 456 Bucket total_; | 460 Bucket total_; |
| 457 | 461 |
| 458 bool profile_mmap_; | 462 bool profile_mmap_; |
| 459 | 463 |
| 464 // Should /proc/self/maps information be included in the profile? |
| 465 bool profile_self_maps_; |
| 466 |
| 460 // Bucket hash table for malloc. | 467 // Bucket hash table for malloc. |
| 461 // We hand-craft one instead of using one of the pre-written | 468 // We hand-craft one instead of using one of the pre-written |
| 462 // ones because we do not want to use malloc when operating on the table. | 469 // ones because we do not want to use malloc when operating on the table. |
| 463 // It is only few lines of code, so no big deal. | 470 // It is only few lines of code, so no big deal. |
| 464 Bucket** bucket_table_; | 471 Bucket** bucket_table_; |
| 465 int num_buckets_; | 472 int num_buckets_; |
| 466 | 473 |
| 467 // Map of all currently allocated objects and mapped regions we know about. | 474 // Map of all currently allocated objects and mapped regions we know about. |
| 468 AllocationMap* address_map_; | 475 AllocationMap* address_map_; |
| 469 | 476 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 // Helpers for sorting and generating leak reports | 523 // Helpers for sorting and generating leak reports |
| 517 struct Entry; | 524 struct Entry; |
| 518 struct ReportState; | 525 struct ReportState; |
| 519 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*); | 526 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*); |
| 520 static void ReportObject(const void* ptr, AllocValue* v, char*); | 527 static void ReportObject(const void* ptr, AllocValue* v, char*); |
| 521 | 528 |
| 522 DISALLOW_COPY_AND_ASSIGN(Snapshot); | 529 DISALLOW_COPY_AND_ASSIGN(Snapshot); |
| 523 }; | 530 }; |
| 524 | 531 |
| 525 #endif // BASE_HEAP_PROFILE_TABLE_H_ | 532 #endif // BASE_HEAP_PROFILE_TABLE_H_ |
| OLD | NEW |