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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 * but the currently accumulated profiling information will be cleared. | 83 * but the currently accumulated profiling information will be cleared. |
84 */ | 84 */ |
85 PERFTOOLS_DLL_DECL void HeapProfilerStop(); | 85 PERFTOOLS_DLL_DECL void HeapProfilerStop(); |
86 | 86 |
87 /* Dump a profile now - can be used for dumping at a hopefully | 87 /* Dump a profile now - can be used for dumping at a hopefully |
88 * quiescent state in your program, in order to more easily track down | 88 * quiescent state in your program, in order to more easily track down |
89 * memory leaks. Will include the reason in the logged message | 89 * memory leaks. Will include the reason in the logged message |
90 */ | 90 */ |
91 PERFTOOLS_DLL_DECL void HeapProfilerDump(const char *reason); | 91 PERFTOOLS_DLL_DECL void HeapProfilerDump(const char *reason); |
92 | 92 |
| 93 /* Dump a profile to a file now and store the dumped filename to |
| 94 * "dumped_filename_buffer" which has a length of "filename_buffer_length" |
| 95 * in addition to HeapProfilerDump(). |
| 96 */ |
| 97 PERFTOOLS_DLL_DECL void HeapProfilerDumpWithFileName( |
| 98 const char *reason, |
| 99 char* dumped_filename_buffer, |
| 100 int filename_buffer_length); |
| 101 |
93 /* Generate current heap profiling information. | 102 /* Generate current heap profiling information. |
94 * Returns an empty string when heap profiling is not active. | 103 * Returns an empty string when heap profiling is not active. |
95 * The returned pointer is a '\0'-terminated string allocated using malloc() | 104 * The returned pointer is a '\0'-terminated string allocated using malloc() |
96 * and should be free()-ed as soon as the caller does not need it anymore. | 105 * and should be free()-ed as soon as the caller does not need it anymore. |
97 */ | 106 */ |
98 PERFTOOLS_DLL_DECL char* GetHeapProfile(); | 107 PERFTOOLS_DLL_DECL char* GetHeapProfile(); |
99 | 108 |
100 /* Callback function for iterating through all allocated objects. Accepts | 109 /* Callback function for iterating through all allocated objects. Accepts |
101 * pointer to user data passed into IterateAllocatedObjects and pointer | 110 * pointer to user data passed into IterateAllocatedObjects and pointer |
102 * to the object being visited. | 111 * to the object being visited. |
103 */ | 112 */ |
104 typedef void (*AddressVisitor)(void* data, const void* ptr); | 113 typedef void (*AddressVisitor)(void* data, const void* ptr); |
105 | 114 |
106 /* Iterate over all live allocated objects. For each allocation the | 115 /* Iterate over all live allocated objects. For each allocation the |
107 * callback will be invoked with the data argument and allocation pointer. | 116 * callback will be invoked with the data argument and allocation pointer. |
108 */ | 117 */ |
109 PERFTOOLS_DLL_DECL void IterateAllocatedObjects(AddressVisitor callback, | 118 PERFTOOLS_DLL_DECL void IterateAllocatedObjects(AddressVisitor callback, |
110 void* data); | 119 void* data); |
111 | 120 |
112 #ifdef __cplusplus | 121 #ifdef __cplusplus |
113 } // extern "C" | 122 } // extern "C" |
114 #endif | 123 #endif |
115 | 124 |
116 #endif /* BASE_HEAP_PROFILER_H_ */ | 125 #endif /* BASE_HEAP_PROFILER_H_ */ |
OLD | NEW |