Contexts update + buffer flushing + cleanup (#338)

* Update lib/rocprofiler-sdk/context/context.*

- get_registered_contexts functions (local copy)

* Update lib/rocprofiler-sdk/hsa/{queue,queue_controller}.cpp

- remove ROCPROFILER_BUFFER_TRACING_MEMORY_COPY code

* Update tests/kernel-tracing/kernel-tracing.cpp

- move stop() and flush() in tool_fini to before reporting of sizes of data collected

* Update lib/rocprofiler-sdk/hsa/hsa.*

- remove stale set_callback / activity_functor_t code

* Update lib/rocprofiler-sdk/buffer.cpp

- full wait instead of returning busy when buffer is busy
- use task_group::join instead of task_group::wait to fully wait for tasks to finish (bug fix)

* Update lib/rocprofiler-sdk/agent.cpp

- support agent mapping for CPU agents

* Remove direct access to vector of registered contexts
Этот коммит содержится в:
Jonathan R. Madsen
2024-01-03 04:26:46 -06:00
коммит произвёл GitHub
родитель c5e45803e9
Коммит 199f0b5421
15 изменённых файлов: 168 добавлений и 168 удалений
+11 -9
Просмотреть файл
@@ -70,7 +70,10 @@ public:
rocprofiler_profile_counting_dispatch_callback_t callback,
void* callback_args)
{
auto& ctx = *rocprofiler::context::get_registered_contexts().at(context_id.handle);
auto* ctx_p = rocprofiler::context::get_mutable_registered_context(context_id);
if(!ctx_p) return false;
auto& ctx = *ctx_p;
if(!ctx.counter_collection)
{
@@ -81,12 +84,11 @@ public:
auto& cb = *ctx.counter_collection->callbacks.emplace_back(
std::make_shared<counter_callback_info>());
cb.user_cb = callback;
cb.callback_args = callback_args;
cb.context = context_id;
cb.buffer = buffer;
cb.internal_context =
rocprofiler::context::get_registered_contexts().at(context_id.handle).get();
cb.user_cb = callback;
cb.callback_args = callback_args;
cb.context = context_id;
cb.buffer = buffer;
cb.internal_context = ctx_p;
return true;
}
@@ -309,7 +311,7 @@ completed_cb(const std::shared_ptr<counter_callback_info>& info,
}
void
start_context(context::context* ctx)
start_context(const context::context* ctx)
{
if(!ctx || !ctx->counter_collection) return;
@@ -346,7 +348,7 @@ start_context(context::context* ctx)
}
void
stop_context(context::context* ctx)
stop_context(const context::context* ctx)
{
if(!ctx || !ctx->counter_collection) return;