Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: third_party/tcmalloc/chromium/src/heap-profile-table.h

Issue 15418002: Record Chrome trace events in tcmalloc heap profiles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup, run in all renderers Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 186
187 // Fill pseudo-stack profile data into buffer 'buf' of size 'size' and
188 // return the actual size occupied by the dump in 'buf'. The output is
189 // JSON formatted. 'buf' will not be zero-terminated.
190 int FillPseudoStackProfile(char buf[], int size) const;
191
187 // Cleanup any old profile files matching prefix + ".*" + kFileExt. 192 // Cleanup any old profile files matching prefix + ".*" + kFileExt.
188 static void CleanupOldProfiles(const char* prefix); 193 static void CleanupOldProfiles(const char* prefix);
189 194
190 // Return a snapshot of the current contents of *this. 195 // Return a snapshot of the current contents of *this.
191 // Caller must call ReleaseSnapshot() on result when no longer needed. 196 // Caller must call ReleaseSnapshot() on result when no longer needed.
192 // The result is only valid while this exists and until 197 // The result is only valid while this exists and until
193 // the snapshot is discarded by calling ReleaseSnapshot(). 198 // the snapshot is discarded by calling ReleaseSnapshot().
194 class Snapshot; 199 class Snapshot;
195 Snapshot* TakeSnapshot(); 200 Snapshot* TakeSnapshot();
196 201
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // counting bucket b. 366 // counting bucket b.
362 // 367 //
363 // "extra" is appended to the unparsed bucket. Typically it is empty, 368 // "extra" is appended to the unparsed bucket. Typically it is empty,
364 // but may be set to something like " heapprofile" for the total 369 // but may be set to something like " heapprofile" for the total
365 // bucket to indicate the type of the profile. 370 // bucket to indicate the type of the profile.
366 static int UnparseBucket(const Bucket& b, 371 static int UnparseBucket(const Bucket& b,
367 char* buf, int buflen, int bufsize, 372 char* buf, int buflen, int bufsize,
368 const char* extra, 373 const char* extra,
369 Stats* profile_stats); 374 Stats* profile_stats);
370 375
376 // Unparse bucket b and print its portion of profile dump into buf.
377 // We return the amount of space in buf that we use. We start printing
378 // at buf + buflen, and promise not to go beyond buf + bufsize.
379 // We do not provision for 0-terminating 'buf'. Output is in JSON format.
380 static int UnparsePseudoStackBucket(
381 const Bucket& b,
382 char* buf, int buflen, int bufsize,
383 Stats* profile_stats);
384
371 // Get the bucket for the caller stack trace 'key' of depth 'depth' 385 // Get the bucket for the caller stack trace 'key' of depth 'depth'
372 // creating the bucket if needed. 386 // creating the bucket if needed.
373 Bucket* GetBucket(int depth, const void* const key[]); 387 Bucket* GetBucket(int depth, const void* const key[]);
374 388
375 // Helper for IterateAllocs to do callback signature conversion 389 // Helper for IterateAllocs to do callback signature conversion
376 // from AllocationMap::Iterate to AllocIterator. 390 // from AllocationMap::Iterate to AllocIterator.
377 static void MapArgsAllocIterator(const void* ptr, AllocValue* v, 391 static void MapArgsAllocIterator(const void* ptr, AllocValue* v,
378 AllocIterator callback) { 392 AllocIterator callback) {
379 AllocInfo info; 393 AllocInfo info;
380 info.object_size = v->bytes; 394 info.object_size = v->bytes;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 // Helpers for sorting and generating leak reports 530 // Helpers for sorting and generating leak reports
517 struct Entry; 531 struct Entry;
518 struct ReportState; 532 struct ReportState;
519 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*); 533 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*);
520 static void ReportObject(const void* ptr, AllocValue* v, char*); 534 static void ReportObject(const void* ptr, AllocValue* v, char*);
521 535
522 DISALLOW_COPY_AND_ASSIGN(Snapshot); 536 DISALLOW_COPY_AND_ASSIGN(Snapshot);
523 }; 537 };
524 538
525 #endif // BASE_HEAP_PROFILE_TABLE_H_ 539 #endif // BASE_HEAP_PROFILE_TABLE_H_
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h ('k') | third_party/tcmalloc/chromium/src/heap-profile-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698