2.3 (revision 117c8d5b)
|
Data Structures | |
struct | OTF2_MemoryCallbacks |
Structure holding the memory callbacks. More... | |
Typedefs | |
typedef void *(* | OTF2_MemoryAllocate) (void *userData, OTF2_FileType fileType, OTF2_LocationRef location, void **perBufferData, uint64_t chunkSize) |
Function pointer for allocating memory for chunks. More... | |
typedef void(* | OTF2_MemoryFreeAll) (void *userData, OTF2_FileType fileType, OTF2_LocationRef location, void **perBufferData, bool final) |
Function pointer to release all allocated chunks. More... | |
It is possible to provide memory for the record chunks to OTF2 via this callback interface. It is only used for writing. The default memory pool has a size of 128 MiB per writer.
Note that these callbacks must be thread safe. They are not protected by the locking callbacks.
typedef void*( * OTF2_MemoryAllocate) (void *userData, OTF2_FileType fileType, OTF2_LocationRef location, void **perBufferData, uint64_t chunkSize) |
Function pointer for allocating memory for chunks.
Please note: Do not use this feature if you do not really understand it. The OTF2 library is not able to do any kind of checks to validate if your memory management works properly. If you do not use it correctly OTF2's behavior is undefined including dead locks and all that nasty stuff.
This function must return a pointer to a valid allocated memory location (just like malloc). This memory location must be of exact same size as the parameter 'chunkSize' provided with OTF2_Archive_Open().
userData | Data passed to the call OTF2_Archive_SetMemoryCallbacks. |
fileType | The file type for which the chunk is requested. |
location | The location ID of the writer for which the flush has happened (for file types without an ID this is OTF2_UNDEFINED_LOCATION). |
perBufferData | A writable pointer to store callee data. For the first call this will be NULL . |
chunkSize | The size of the requested chunk. |
NULL
if an error occurs. typedef void( * OTF2_MemoryFreeAll) (void *userData, OTF2_FileType fileType, OTF2_LocationRef location, void **perBufferData, bool final) |
Function pointer to release all allocated chunks.
Please note: Do not use this feature if you do not really understand it. The OTF2 library is not able to do any kind of checks to validate if your memory management works properly. If you do not use it correctly OTF2's behavior is undefined including dead locks and all that nasty stuff.
This function must free all those memory locations that were allocated for a buffer handle with the according allocate function. Please note: This is different from a posix free(). You must free all memory locations for that were allocated for exactly this buffer handle.
userData | Data passed to the call OTF2_Archive_SetMemoryCallbacks. |
fileType | The file type for which free is requested. |
location | The location ID of the writer for which the flush has happened (for file types without an ID this is OTF2_UNDEFINED_LOCATION). |
perBufferData | A writable pointer to store callee data. For the first call this will be NULL . |
final | Indicates whether this is the final free when closing the writer objects. perBufferData should be handled than. |