Add rocprofiler_load_counter_definition (#1193)

Adds rocprofiler_load_counter_definition. This function allows a counter definition file to be supplied to rocprofiler-sdk directly. Takes in a string containing the counter definition YAML, its size (in bytes), and a flag value to state whether this is an append operation or not.

---------

Co-authored-by: Benjamin Welton <ben@amd.com>
Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
Co-authored-by: usrihari123 <srihari.u@amd.com>
This commit is contained in:
Benjamin Welton
2024-11-22 01:55:47 -08:00
committed by GitHub
parent 7ea9ced493
commit 7ddc72ad45
22 changed files with 384 additions and 8 deletions
+10
View File
@@ -49,6 +49,7 @@
#include <rocprofiler-sdk/agent.h>
#include <rocprofiler-sdk/buffer_tracing.h>
#include <rocprofiler-sdk/callback_tracing.h>
#include <rocprofiler-sdk/experimental/counters.h>
#include <rocprofiler-sdk/external_correlation.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/internal_threading.h>
@@ -1597,6 +1598,15 @@ rocprofiler_configure(uint32_t version,
return compose_tmp_file_name(tool::get_config(), type);
};
if(!tool::get_config().extra_counters_contents.empty())
{
std::string contents(tool::get_config().extra_counters_contents);
size_t length = contents.size();
ROCPROFILER_CALL(rocprofiler_load_counter_definition(
contents.c_str(), length, ROCPROFILER_COUNTER_FLAG_APPEND_DEFINITION),
"Loading extra counters");
}
if(tool::get_config().list_metrics)
{
tool_metadata->init(tool::metadata::inprocess{});