Buffer Handling

Buffer Handling#

Rocprofiler SDK Developer API: Buffer Handling
Rocprofiler SDK Developer API 0.4.0
ROCm Profiling API and tools
Buffer Handling

Creation, destruction, and flushing of buffers populated with data from rocprofiler. More...

Typedefs

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.
 

Functions

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.
 
rocprofiler_status_t rocprofiler_destroy_buffer (rocprofiler_buffer_id_t buffer_id)
 Destroy buffer.
 
rocprofiler_status_t rocprofiler_flush_buffer (rocprofiler_buffer_id_t buffer_id)
 Flush buffer.
 

Detailed Description

Creation, destruction, and flushing of buffers populated with data from rocprofiler.

Every Buffer is associated with a specific service kind. OR Every Buffer is associated with a specific service ID.

Typedef Documentation

◆ rocprofiler_buffer_tracing_cb_t

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);
...
}
}
Generic record with type identifier(s) and a pointer to data. This data type is used with buffered da...
Definition fwd.h:617

Definition at line 57 of file buffer.h.

Function Documentation

◆ rocprofiler_create_buffer()

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
[in]contextContext identifier associated with buffer
[in]sizeSize of the buffer in bytes
[in]watermark- watermark size, where the callback is called, if set to 0 then the callback will be called on every record
[in]policyBehavior policy when buffer is full
[in]callbackCallback to invoke when buffer is flushed/full
[in]callback_dataData to provide in callback function
[out]buffer_idIdentification handle for buffer
Returns
rocprofiler_status_t
Examples
api_buffered_tracing/client.cpp.

◆ rocprofiler_destroy_buffer()

rocprofiler_status_t rocprofiler_destroy_buffer ( rocprofiler_buffer_id_t  buffer_id)

Destroy buffer.

Parameters
[in]buffer_id
Returns
rocprofiler_status_t

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.

◆ rocprofiler_flush_buffer()

rocprofiler_status_t rocprofiler_flush_buffer ( rocprofiler_buffer_id_t  buffer_id)

Flush buffer.

Parameters
[in]buffer_id
Returns
rocprofiler_status_t
Examples
api_buffered_tracing/client.cpp.