OLD | NEW |
---|---|
1 /* Copyright (c) 2005, Google Inc. | 1 /* Copyright (c) 2005, 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 # endif | 61 # endif |
62 #endif | 62 #endif |
63 | 63 |
64 /* All this code should be usable from within C apps. */ | 64 /* All this code should be usable from within C apps. */ |
65 #ifdef __cplusplus | 65 #ifdef __cplusplus |
66 extern "C" { | 66 extern "C" { |
67 #endif | 67 #endif |
68 | 68 |
69 /* Start profiling and arrange to write profile data to file names | 69 /* Start profiling and arrange to write profile data to file names |
70 * of the form: "prefix.0000", "prefix.0001", ... | 70 * of the form: "prefix.0000", "prefix.0001", ... |
71 * |prefix| may be NULL, which prevents writing to disk. This is useful for | |
72 * applications that exclusively use GetHeapProfile(). | |
Dai Mikurube (NOT FULLTIME)
2013/06/19 04:34:03
This comment looks confusing. The existing profil
James Cook
2013/06/29 00:02:42
Updated the comment. I think the system considers
| |
71 */ | 73 */ |
72 PERFTOOLS_DLL_DECL void HeapProfilerStart(const char* prefix); | 74 PERFTOOLS_DLL_DECL void HeapProfilerStart(const char* prefix); |
73 | 75 |
74 /* Returns non-zero if we are currently profiling the heap. (Returns | 76 /* Returns non-zero if we are currently profiling the heap. (Returns |
75 * an int rather than a bool so it's usable from C.) This is true | 77 * an int rather than a bool so it's usable from C.) This is true |
76 * between calls to HeapProfilerStart() and HeapProfilerStop(), and | 78 * between calls to HeapProfilerStart() and HeapProfilerStop(), and |
77 * also if the program has been run with HEAPPROFILER, or some other | 79 * also if the program has been run with HEAPPROFILER, or some other |
78 * way to turn on whole-program profiling. | 80 * way to turn on whole-program profiling. |
79 */ | 81 */ |
80 int IsHeapProfilerRunning(); | 82 int IsHeapProfilerRunning(); |
(...skipping 21 matching lines...) Expand all Loading... | |
102 * to the object being visited. | 104 * to the object being visited. |
103 */ | 105 */ |
104 typedef void (*AddressVisitor)(void* data, const void* ptr); | 106 typedef void (*AddressVisitor)(void* data, const void* ptr); |
105 | 107 |
106 /* Iterate over all live allocated objects. For each allocation the | 108 /* Iterate over all live allocated objects. For each allocation the |
107 * callback will be invoked with the data argument and allocation pointer. | 109 * callback will be invoked with the data argument and allocation pointer. |
108 */ | 110 */ |
109 PERFTOOLS_DLL_DECL void IterateAllocatedObjects(AddressVisitor callback, | 111 PERFTOOLS_DLL_DECL void IterateAllocatedObjects(AddressVisitor callback, |
110 void* data); | 112 void* data); |
111 | 113 |
114 /* Sets a callback function to return a pseudo-stack for application-generated | |
115 * stacks during heap profiling. The caller must provide a buffer in |stack| | |
116 * of at least size 32 * sizeof(void*). Returns the number of items copied or | |
117 * zero. | |
118 */ | |
119 typedef int (*PseudoStackGenerator)(void** stack); | |
120 PERFTOOLS_DLL_DECL void SetPseudoStackGenerator(PseudoStackGenerator callback); | |
121 | |
112 #ifdef __cplusplus | 122 #ifdef __cplusplus |
113 } // extern "C" | 123 } // extern "C" |
114 #endif | 124 #endif |
115 | 125 |
116 #endif /* BASE_HEAP_PROFILER_H_ */ | 126 #endif /* BASE_HEAP_PROFILER_H_ */ |
OLD | NEW |