Buffer handling#
-
typedef void (*rocprofiler_buffer_tracing_cb_t)(rocprofiler_context_id_t context, rocprofiler_buffer_id_t buffer_id, rocprofiler_record_header_t **headers, unsigned long num_headers, void *data, uint64_t drop_count)#
Async callback function.
for(size_t i = 0; i < num_headers; ++i) { rocprofiler_record_header_t* hdr = headers[i]; if(hdr->kind == ROCPROFILER_RECORD_KIND_PC_SAMPLE) { auto* data = static_cast<rocprofiler_pc_sample_t*>(&hdr->payload); ... } }
-
rocprofiler_status_t rocprofiler_create_buffer(rocprofiler_context_id_t context, unsigned long size, unsigned long watermark, rocprofiler_buffer_policy_t policy, rocprofiler_buffer_tracing_cb_t callback, void *callback_data, rocprofiler_buffer_id_t *buffer_id)#
Create buffer.
- Parameters:
context – [in] Context identifier associated with buffer
size – [in] Size of the buffer in bytes
watermark – [in] - watermark size, where the callback is called, if set to 0 then the callback will be called on every record
policy – [in] Behavior policy when buffer is full
callback – [in] Callback to invoke when buffer is flushed/full
callback_data – [in] Data to provide in callback function
buffer_id – [out] Identification handle for buffer
- Returns:
-
rocprofiler_status_t rocprofiler_destroy_buffer(rocprofiler_buffer_id_t buffer_id)#
Destroy buffer.
Note: This will destroy the buffer even if it is not empty. The user can call rocprofiler_flush_buffer before it to make sure the buffer is empty.
- Parameters:
buffer_id – [in]
- Returns:
-
rocprofiler_status_t rocprofiler_flush_buffer(rocprofiler_buffer_id_t buffer_id)#
Flush buffer.
- Parameters:
buffer_id – [in]
- Returns: