Check to force tools to initialize the ctx id to zero. (#1135)

* Check to force tool to initialize the ctx id to zero.

* initialize rocprofiler_context_id_t with 0 in units tests

* changelog

---------

Co-authored-by: Gopesh Bhardwaj <gopesh.bhardwaj@amd.com>
This commit is contained in:
venkat1361
2024-10-22 07:39:25 -05:00
committed by GitHub
parent a92fa8f071
commit 3f91d90bbc
36 changed files with 66 additions and 61 deletions
@@ -84,7 +84,7 @@ rocprofiler_assign_callback_thread(rocprofiler_buffer_id_t buffer_id,
```cpp
{
// create a context
auto context_id = rocprofiler_context_id_t{};
auto context_id = rocprofiler_context_id_t{0};
rocprofiler_create_context(&context_id);
// create a buffer associated with the context
@@ -31,7 +31,7 @@ This guide explains how to setup dispatch and agent profiling along will describ
The setup for dispatch and agent profiling is similar (with only minor changes needed to adapt code from one to another). In tool_init, similar to tracing services, you need to create a context and a buffer to collect the output. Important Note: buffered_callback in rocprofiler_create_buffer is called when the buffer is full with a vector of collected counter samples, see the buffered callback section below for processing.
```CPP
rocprofiler_context_id_t ctx;
rocprofiler_context_id_t ctx{0};
rocprofiler_buffer_id_t buff;
ROCPROFILER_CALL(rocprofiler_create_context(&ctx), "context creation failed");
ROCPROFILER_CALL(rocprofiler_create_buffer(ctx,
+2 -2
View File
@@ -92,7 +92,7 @@ tool_init(rocprofiler_client_finalize_t fini_func,
void* data_v)
{
// create a context
auto ctx = rocprofiler_context_id_t{};
auto ctx = rocprofiler_context_id_t{0};
rocprofiler_create_context(&ctx);
// ... associate services with context ...
@@ -178,7 +178,7 @@ tool_init(rocprofiler_client_finalize_t fini_func,
tool_data->finalizer = fini_func;
// create a context
auto ctx = rocprofiler_context_id_t{};
auto ctx = rocprofiler_context_id_t{0};
rocprofiler_create_context(&ctx);
// Save your contexts