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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Fill profile data into buffer 'buf' of size 'size' | 180 // Fill profile data into buffer 'buf' of size 'size' |
181 // and return the actual size occupied by the dump in 'buf'. | 181 // and return the actual size occupied by the dump in 'buf'. |
182 // The profile buckets are dumped in the decreasing order | 182 // The profile buckets are dumped in the decreasing order |
183 // of currently allocated bytes. | 183 // of currently allocated bytes. |
184 // We do not provision for 0-terminating 'buf'. | 184 // We do not provision for 0-terminating 'buf'. |
185 int FillOrderedProfile(char buf[], int size) const; | 185 int FillOrderedProfile(char buf[], int size) const; |
| 186 int FillOrderedProfile2(char buf[], int size) const; |
186 | 187 |
187 // Cleanup any old profile files matching prefix + ".*" + kFileExt. | 188 // Cleanup any old profile files matching prefix + ".*" + kFileExt. |
188 static void CleanupOldProfiles(const char* prefix); | 189 static void CleanupOldProfiles(const char* prefix); |
189 | 190 |
190 // Return a snapshot of the current contents of *this. | 191 // Return a snapshot of the current contents of *this. |
191 // Caller must call ReleaseSnapshot() on result when no longer needed. | 192 // Caller must call ReleaseSnapshot() on result when no longer needed. |
192 // The result is only valid while this exists and until | 193 // The result is only valid while this exists and until |
193 // the snapshot is discarded by calling ReleaseSnapshot(). | 194 // the snapshot is discarded by calling ReleaseSnapshot(). |
194 class Snapshot; | 195 class Snapshot; |
195 Snapshot* TakeSnapshot(); | 196 Snapshot* TakeSnapshot(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // If profile_stats is non-NULL, we update *profile_stats by | 361 // If profile_stats is non-NULL, we update *profile_stats by |
361 // counting bucket b. | 362 // counting bucket b. |
362 // | 363 // |
363 // "extra" is appended to the unparsed bucket. Typically it is empty, | 364 // "extra" is appended to the unparsed bucket. Typically it is empty, |
364 // but may be set to something like " heapprofile" for the total | 365 // but may be set to something like " heapprofile" for the total |
365 // bucket to indicate the type of the profile. | 366 // bucket to indicate the type of the profile. |
366 static int UnparseBucket(const Bucket& b, | 367 static int UnparseBucket(const Bucket& b, |
367 char* buf, int buflen, int bufsize, | 368 char* buf, int buflen, int bufsize, |
368 const char* extra, | 369 const char* extra, |
369 Stats* profile_stats); | 370 Stats* profile_stats); |
| 371 static int UnparseBucket2(const Bucket& b, |
| 372 char* buf, int buflen, int bufsize, |
| 373 Stats* profile_stats); |
370 | 374 |
371 // Get the bucket for the caller stack trace 'key' of depth 'depth' | 375 // Get the bucket for the caller stack trace 'key' of depth 'depth' |
372 // creating the bucket if needed. | 376 // creating the bucket if needed. |
373 Bucket* GetBucket(int depth, const void* const key[]); | 377 Bucket* GetBucket(int depth, const void* const key[]); |
374 | 378 |
375 // Helper for IterateAllocs to do callback signature conversion | 379 // Helper for IterateAllocs to do callback signature conversion |
376 // from AllocationMap::Iterate to AllocIterator. | 380 // from AllocationMap::Iterate to AllocIterator. |
377 static void MapArgsAllocIterator(const void* ptr, AllocValue* v, | 381 static void MapArgsAllocIterator(const void* ptr, AllocValue* v, |
378 AllocIterator callback) { | 382 AllocIterator callback) { |
379 AllocInfo info; | 383 AllocInfo info; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // Helpers for sorting and generating leak reports | 520 // Helpers for sorting and generating leak reports |
517 struct Entry; | 521 struct Entry; |
518 struct ReportState; | 522 struct ReportState; |
519 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*); | 523 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*); |
520 static void ReportObject(const void* ptr, AllocValue* v, char*); | 524 static void ReportObject(const void* ptr, AllocValue* v, char*); |
521 | 525 |
522 DISALLOW_COPY_AND_ASSIGN(Snapshot); | 526 DISALLOW_COPY_AND_ASSIGN(Snapshot); |
523 }; | 527 }; |
524 | 528 |
525 #endif // BASE_HEAP_PROFILE_TABLE_H_ | 529 #endif // BASE_HEAP_PROFILE_TABLE_H_ |
OLD | NEW |