Cleanup + logging env variable (#387)

* [CP] Update tests/common/serialization.hpp

- remove duplication in rocprofiler_callback_tracing_code_object_load_data_t

* [CP] Update lib/rocprofiler-sdk/tests

- create common.hpp
- update registration.cpp to use common.hpp

* [CP] Add lib/common/logging.{hpp,cpp}

- generic init_logging function

* [CP] Update lib/rocprofiler-sdk/hsa/async_copy.cpp

- remove excess logging

* [CP] Update lib/rocprofiler-sdk/registration.cpp

- use common::init_logging(...)
- enforce ROCPROFILER_REGISTER_FORCE_LOAD in rocprofiler_force_configure
- logging updates in rocprofiler_set_api_table

* Update include/rocprofiler-sdk/buffer_tracing.h

- rocprofiler_buffer_tracing_marker_record_t -> rocprofiler_buffer_tracing_marker_api_record_t

* Update lib/common/utility.hpp

- remove active_capacity_gate

* Update lib/rocprofiler-sdk/tests/common.hpp

- fix get_{callback,buffer}_tracing_names()

* Update lib/rocprofiler-sdk/counters/xml/{basic,derived}_counters.xml

- add entries for gfx1102

[ROCm/rocprofiler-sdk commit: dc8b8aa448]
Cette révision appartient à :
Jonathan R. Madsen
2024-01-17 00:28:20 -06:00
révisé par GitHub
Parent 871048b7b9
révision 12bc6c93d7
12 fichiers modifiés avec 341 ajouts et 239 suppressions
+1 -1
Voir le fichier
@@ -76,7 +76,7 @@ typedef struct
rocprofiler_thread_id_t thread_id; ///< id for thread generating this record
uint64_t marker_id; ///< rocprofiler_marker_id_t
// const char* message; // (Need Review?)
} rocprofiler_buffer_tracing_marker_record_t;
} rocprofiler_buffer_tracing_marker_api_record_t;
/**
* @brief ROCProfiler Buffer Memory Copy Tracer Record.
+3 -2
Voir le fichier
@@ -3,13 +3,14 @@
#
rocprofiler_activate_clang_tidy()
set(common_sources config.cpp environment.cpp demangle.cpp static_object.cpp utility.cpp
xml.cpp)
set(common_sources config.cpp environment.cpp demangle.cpp logging.cpp static_object.cpp
utility.cpp xml.cpp)
set(common_headers
config.hpp
defines.hpp
environment.hpp
demangle.hpp
logging.hpp
mpl.hpp
scope_destructor.hpp
static_object.hpp
+86
Voir le fichier
@@ -0,0 +1,86 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "lib/common/logging.hpp"
#include "lib/common/environment.hpp"
#include <fmt/format.h>
#include <glog/logging.h>
#include <fstream>
#include <mutex>
#include <unordered_map>
namespace rocprofiler
{
namespace common
{
void
init_logging(std::string_view env_var)
{
static auto _once = std::once_flag{};
std::call_once(_once, [env_var]() {
auto get_argv0 = []() {
auto ifs = std::ifstream{"/proc/self/cmdline"};
auto sarg = std::string{};
while(ifs && !ifs.eof())
{
ifs >> sarg;
if(!sarg.empty()) break;
}
return sarg;
};
static auto argv0 = get_argv0();
google::InitGoogleLogging(argv0.c_str());
auto loglvl = common::get_env(env_var, "error");
for(auto& itr : loglvl)
itr = tolower(itr);
// default to warning
auto loglvl_v = google::WARNING;
if(loglvl.find_first_not_of("0123456789") == std::string::npos)
{
loglvl_v = std::stoul(loglvl);
}
else
{
const auto opts =
std::unordered_map<std::string_view, uint32_t>{{"info", google::INFO},
{"warning", google::WARNING},
{"error", google::ERROR},
{"fatal", google::FATAL}};
if(opts.find(loglvl) == opts.end())
throw std::runtime_error{
fmt::format("invalid specifier for ROCPROFILER_LOG_LEVEL: {}. Supported: info, "
"warning, error, fatal",
loglvl)};
else
loglvl_v = opts.at(loglvl);
}
FLAGS_minloglevel = loglvl_v;
FLAGS_stderrthreshold = loglvl_v;
LOG(INFO) << "logging initialized";
});
}
} // namespace common
} // namespace rocprofiler
+34
Voir le fichier
@@ -0,0 +1,34 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
#include <string_view>
namespace rocprofiler
{
namespace common
{
void
init_logging(std::string_view env_var);
}
} // namespace rocprofiler
-61
Voir le fichier
@@ -210,66 +210,5 @@ private:
data_type m_data = {};
functor_type m_destroy_func = {};
};
/**
* Limits the number of active items to those set in capacity.
* If capacity is reached, will block until another caller
* removes active capacity.
*/
class active_capacity_gate
{
public:
active_capacity_gate(size_t capacity);
void add_active(size_t size);
void remove_active(size_t size);
private:
size_t _count{0};
size_t _capacity{0};
size_t _waiters{0};
std::mutex _m;
std::condition_variable _cv;
};
inline active_capacity_gate::active_capacity_gate(size_t capacity)
: _capacity(capacity)
{}
inline void
active_capacity_gate::add_active(size_t size)
{
if(size >= _capacity)
{
throw std::runtime_error("Size exceeds gate capacity");
}
std::unique_lock lock(_m);
if(_count + size < _capacity)
{
_count += size;
return;
}
_waiters++;
_cv.wait(lock, [&]() { return _count + size < _capacity; });
_waiters--;
_count += size;
}
inline void
active_capacity_gate::remove_active(size_t size)
{
std::unique_lock lock(_m);
if(_count > size)
_count -= size;
else
_count = 0;
if(_waiters > 0)
{
_cv.notify_all();
}
}
} // namespace common
} // namespace rocprofiler
@@ -772,3 +772,6 @@
<gfx1101 base="gfx11">
</gfx1101>
<gfx1102 base="gfx11">
</gfx1102>
@@ -498,6 +498,9 @@
<gfx1101 base="gfx11">
</gfx1101>
<gfx1102 base="gfx11">
</gfx1102>
<gfx8 base="gfx8"></gfx8>
<gfx9 base="gfx9"></gfx9>
<gfx10 base="gfx10"></gfx10>
@@ -519,6 +522,7 @@
#Navi31
<gfx1100 base="gfx1100"></gfx1100>
<gfx1101 base="gfx1101"></gfx1101>
<gfx1102 base="gfx1102"></gfx1102>
<global>
-11
Voir le fichier
@@ -103,8 +103,6 @@ convert_hsa_handle(Up _hsa_object)
bool
async_copy_handler(hsa_signal_value_t signal_value, void* arg)
{
LOG(ERROR) << "[" << __FUNCTION__ << "] invoked with signal value " << signal_value;
static auto sysclock_period = []() -> uint64_t {
constexpr auto nanosec = 1000000000UL;
uint64_t sysclock_hz = 0;
@@ -123,9 +121,6 @@ async_copy_handler(hsa_signal_value_t signal_value, void* arg)
copy_time.start *= sysclock_period;
copy_time.end *= sysclock_period;
LOG(ERROR) << "[" << __FUNCTION__ << "] start=" << copy_time.start << ", end=" << copy_time.end
<< ", delta=" << (copy_time.end - copy_time.start) << ", period=" << sysclock_period;
// if we encounter this in CI, it will cause test to fail
ROCP_CI_LOG_IF(ERROR, copy_time_status == HSA_STATUS_SUCCESS && copy_time.end < copy_time.start)
<< "hsa_amd_profiling_get_async_copy_time for returned async times where the end time ("
@@ -204,8 +199,6 @@ async_copy_handler(hsa_signal_value_t signal_value, void* arg)
delete _data;
}
LOG(ERROR) << "[" << __FUNCTION__ << "] completed (signal value " << signal_value << ")";
return (signal_value > 0);
}
@@ -257,8 +250,6 @@ async_copy_impl(Args... args)
constexpr auto N = sizeof...(Args);
LOG(ERROR) << "[" << __FUNCTION__ << "] started...";
auto&& _tied_args = std::tie(args...);
auto ctxs = context::get_active_contexts(context_filter);
@@ -415,8 +406,6 @@ async_copy_impl(Args... args)
_data->orig_signal = _completion_signal;
_completion_signal = _data->rocp_signal;
auto _dtor = common::scope_destructor{[]() { LOG(ERROR) << "[async_copy_impl] ... returned"; }};
return invoke(get_next_dispatch<Idx>(), std::move(_tied_args), std::make_index_sequence<N>{});
}
+14 -17
Voir le fichier
@@ -22,6 +22,7 @@
#include "lib/rocprofiler-sdk/registration.hpp"
#include "lib/common/environment.hpp"
#include "lib/common/logging.hpp"
#include "lib/common/static_object.hpp"
#include "lib/rocprofiler-sdk/agent.hpp"
#include "lib/rocprofiler-sdk/context/context.hpp"
@@ -36,6 +37,7 @@
#include <rocprofiler-sdk/context.h>
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/hsa.h>
#include <rocprofiler-sdk/marker.h>
#include <rocprofiler-sdk/version.h>
#include <fmt/format.h>
@@ -45,6 +47,7 @@
#include <link.h>
#include <unistd.h>
#include <atomic>
#include <cctype>
#include <cstdint>
#include <fstream>
#include <iostream>
@@ -477,25 +480,12 @@ invoke_client_finalizer(rocprofiler_client_id_t client_id)
void
init_logging()
{
static auto _once = std::once_flag{};
std::call_once(_once, []() {
auto get_argv0 = []() {
auto ifs = std::ifstream{"/proc/self/cmdline"};
auto sarg = std::string{};
while(ifs && !ifs.eof())
{
ifs >> sarg;
if(!sarg.empty()) break;
}
return sarg;
};
static auto argv0 = get_argv0();
google::InitGoogleLogging(argv0.c_str());
LOG(INFO) << "logging initialized";
});
common::init_logging("ROCPROFILER_LOG_LEVEL");
}
// ensure that logging is always initialized when library is loaded
bool init_logging_at_load = (init_logging(), true);
uint32_t
get_client_offset()
{
@@ -619,6 +609,7 @@ rocprofiler_force_configure(rocprofiler_configure_func_t configure_func)
// let's just make sure that the forced configure function is a nullptr
if(forced_config) return ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED;
setenv("ROCPROFILER_REGISTER_FORCE_LOAD", "1", 1);
forced_config = configure_func;
rocprofiler::registration::initialize();
@@ -632,6 +623,12 @@ rocprofiler_set_api_table(const char* name,
void** tables,
uint64_t num_tables)
{
// implementation has a call once
rocprofiler::registration::init_logging();
LOG(ERROR) << __FUNCTION__ << "(\"" << name << "\", " << lib_version << ", " << lib_instance
<< ", ..., " << num_tables << ")";
static auto _once = std::once_flag{};
std::call_once(_once, rocprofiler::registration::initialize);
+192
Voir le fichier
@@ -0,0 +1,192 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include <rocprofiler-sdk/rocprofiler.h>
#include "lib/common/defines.hpp"
#include <gtest/gtest.h>
#include <cstdint>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ROCPROFILER_CALL(ARG, MSG) \
{ \
auto _status = (ARG); \
EXPECT_EQ(_status, ROCPROFILER_STATUS_SUCCESS) << MSG << " :: " << #ARG; \
}
namespace
{
struct callback_data
{
rocprofiler_client_id_t* client_id = nullptr;
rocprofiler_client_finalize_t client_fini_func = nullptr;
rocprofiler_context_id_t client_ctx = {};
rocprofiler_buffer_id_t client_buffer = {};
rocprofiler_callback_thread_t client_thread = {};
uint64_t client_workflow_count = {};
uint64_t client_callback_count = {};
uint64_t client_elapsed = {};
int64_t current_depth = 0;
int64_t max_depth = 0;
};
struct agent_data
{
uint64_t agent_count = 0;
std::vector<hsa_device_type_t> agents = {};
};
using callback_kind_names_t = std::map<rocprofiler_callback_tracing_kind_t, const char*>;
using callback_kind_operation_names_t =
std::map<rocprofiler_callback_tracing_kind_t, std::map<uint32_t, const char*>>;
struct callback_name_info
{
callback_kind_names_t kind_names = {};
callback_kind_operation_names_t operation_names = {};
};
inline auto
get_callback_tracing_names()
{
static const auto supported_kinds = std::unordered_set<rocprofiler_callback_tracing_kind_t>{
ROCPROFILER_CALLBACK_TRACING_HSA_API};
auto cb_name_info = callback_name_info{};
//
// callback for each kind operation
//
static auto tracing_kind_operation_cb =
[](rocprofiler_callback_tracing_kind_t kindv, uint32_t operation, void* data_v) {
auto* name_info_v = static_cast<callback_name_info*>(data_v);
if(supported_kinds.count(kindv) > 0)
{
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_callback_tracing_kind_operation_name(
kindv, operation, &name, nullptr),
"query callback tracing kind operation name");
EXPECT_TRUE(name != nullptr) << "kind=" << kindv << ", operation=" << operation;
if(name) name_info_v->operation_names[kindv][operation] = name;
}
return 0;
};
//
// callback for each callback kind (i.e. domain)
//
static auto tracing_kind_cb = [](rocprofiler_callback_tracing_kind_t kind, void* data) {
// store the callback kind name
auto* name_info_v = static_cast<callback_name_info*>(data);
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_callback_tracing_kind_name(kind, &name, nullptr),
"query callback tracing kind operation name");
EXPECT_TRUE(name != nullptr) << "kind=" << kind;
if(name) name_info_v->kind_names[kind] = name;
if(supported_kinds.count(kind) > 0)
{
ROCPROFILER_CALL(rocprofiler_iterate_callback_tracing_kind_operations(
kind, tracing_kind_operation_cb, static_cast<void*>(data)),
"iterating callback tracing kind operations");
}
return 0;
};
ROCPROFILER_CALL(rocprofiler_iterate_callback_tracing_kinds(tracing_kind_cb,
static_cast<void*>(&cb_name_info)),
"iterating callback tracing kinds");
return cb_name_info;
}
using buffer_kind_names_t = std::map<rocprofiler_buffer_tracing_kind_t, const char*>;
using buffer_kind_operation_names_t =
std::map<rocprofiler_buffer_tracing_kind_t, std::map<uint32_t, const char*>>;
struct buffer_name_info
{
buffer_kind_names_t kind_names = {};
buffer_kind_operation_names_t operation_names = {};
};
inline buffer_name_info
get_buffer_tracing_names()
{
static const auto supported_kinds =
std::unordered_set<rocprofiler_buffer_tracing_kind_t>{ROCPROFILER_BUFFER_TRACING_HSA_API};
auto cb_name_info = buffer_name_info{};
//
// callback for each kind operation
//
static auto tracing_kind_operation_cb =
[](rocprofiler_buffer_tracing_kind_t kindv, uint32_t operation, void* data_v) {
auto* name_info_v = static_cast<buffer_name_info*>(data_v);
if(supported_kinds.count(kindv) > 0)
{
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_buffer_tracing_kind_operation_name(
kindv, operation, &name, nullptr),
"query buffer tracing kind operation name");
EXPECT_TRUE(name != nullptr) << "kind=" << kindv << ", operation=" << operation;
if(name) name_info_v->operation_names[kindv][operation] = name;
}
return 0;
};
//
// callback for each buffer kind (i.e. domain)
//
static auto tracing_kind_cb = [](rocprofiler_buffer_tracing_kind_t kind, void* data) {
// store the buffer kind name
auto* name_info_v = static_cast<buffer_name_info*>(data);
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_buffer_tracing_kind_name(kind, &name, nullptr),
"query buffer tracing kind operation name");
EXPECT_TRUE(name != nullptr) << "kind=" << kind;
if(name) name_info_v->kind_names[kind] = name;
if(supported_kinds.count(kind) > 0)
{
ROCPROFILER_CALL(rocprofiler_iterate_buffer_tracing_kind_operations(
kind, tracing_kind_operation_cb, static_cast<void*>(data)),
"iterating buffer tracing kind operations");
}
return 0;
};
ROCPROFILER_CALL(rocprofiler_iterate_buffer_tracing_kinds(tracing_kind_cb,
static_cast<void*>(&cb_name_info)),
"iterating buffer tracing kinds");
return cb_name_info;
}
} // namespace
+3 -144
Voir le fichier
@@ -28,6 +28,7 @@
#include "lib/common/filesystem.hpp"
#include "lib/common/units.hpp"
#include "lib/common/utility.hpp"
#include "lib/rocprofiler-sdk/tests/common.hpp"
#include <gtest/gtest.h>
@@ -45,152 +46,8 @@
#include <unordered_map>
#include <vector>
#define ROCPROFILER_CALL(ARG, MSG) \
{ \
auto _status = (ARG); \
EXPECT_EQ(_status, ROCPROFILER_STATUS_SUCCESS) << MSG << " :: " << #ARG; \
}
namespace
{
struct callback_data
{
rocprofiler_client_id_t* client_id = nullptr;
rocprofiler_client_finalize_t client_fini_func = nullptr;
rocprofiler_context_id_t client_ctx = {};
rocprofiler_buffer_id_t client_buffer = {};
rocprofiler_callback_thread_t client_thread = {};
uint64_t client_workflow_count = {};
uint64_t client_callback_count = {};
uint64_t client_elapsed = {};
int64_t current_depth = 0;
int64_t max_depth = 0;
};
struct agent_data
{
uint64_t agent_count = 0;
std::vector<hsa_device_type_t> agents = {};
};
using callback_kind_names_t = std::map<rocprofiler_callback_tracing_kind_t, const char*>;
using callback_kind_operation_names_t =
std::map<rocprofiler_callback_tracing_kind_t, std::map<uint32_t, const char*>>;
struct callback_name_info
{
callback_kind_names_t kind_names = {};
callback_kind_operation_names_t operation_names = {};
};
auto
get_callback_tracing_names()
{
auto cb_name_info = callback_name_info{};
//
// callback for each kind operation
//
static auto tracing_kind_operation_cb =
[](rocprofiler_callback_tracing_kind_t kindv, uint32_t operation, void* data_v) {
auto* name_info_v = static_cast<callback_name_info*>(data_v);
if(kindv == ROCPROFILER_CALLBACK_TRACING_HSA_API)
{
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_callback_tracing_kind_operation_name(
kindv, operation, &name, nullptr),
"query callback tracing kind operation name");
if(name) name_info_v->operation_names[kindv][operation] = name;
}
return 0;
};
//
// callback for each callback kind (i.e. domain)
//
static auto tracing_kind_cb = [](rocprofiler_callback_tracing_kind_t kind, void* data) {
// store the callback kind name
auto* name_info_v = static_cast<callback_name_info*>(data);
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_callback_tracing_kind_name(kind, &name, nullptr),
"query callback tracing kind operation name");
if(name) name_info_v->kind_names[kind] = name;
if(kind == ROCPROFILER_CALLBACK_TRACING_HSA_API)
{
ROCPROFILER_CALL(rocprofiler_iterate_callback_tracing_kind_operations(
kind, tracing_kind_operation_cb, static_cast<void*>(data)),
"iterating callback tracing kind operations");
}
return 0;
};
ROCPROFILER_CALL(rocprofiler_iterate_callback_tracing_kinds(tracing_kind_cb,
static_cast<void*>(&cb_name_info)),
"iterating callback tracing kinds");
return cb_name_info;
}
using buffer_kind_names_t = std::map<rocprofiler_buffer_tracing_kind_t, const char*>;
using buffer_kind_operation_names_t =
std::map<rocprofiler_buffer_tracing_kind_t, std::map<uint32_t, const char*>>;
struct buffer_name_info
{
buffer_kind_names_t kind_names = {};
buffer_kind_operation_names_t operation_names = {};
};
buffer_name_info
get_buffer_tracing_names()
{
auto cb_name_info = buffer_name_info{};
//
// callback for each kind operation
//
static auto tracing_kind_operation_cb =
[](rocprofiler_buffer_tracing_kind_t kindv, uint32_t operation, void* data_v) {
auto* name_info_v = static_cast<buffer_name_info*>(data_v);
if(kindv == ROCPROFILER_BUFFER_TRACING_HSA_API)
{
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_buffer_tracing_kind_operation_name(
kindv, operation, &name, nullptr),
"query buffer tracing kind operation name");
if(name) name_info_v->operation_names[kindv][operation] = name;
}
return 0;
};
//
// callback for each buffer kind (i.e. domain)
//
static auto tracing_kind_cb = [](rocprofiler_buffer_tracing_kind_t kind, void* data) {
// store the buffer kind name
auto* name_info_v = static_cast<buffer_name_info*>(data);
const char* name = nullptr;
ROCPROFILER_CALL(rocprofiler_query_buffer_tracing_kind_name(kind, &name, nullptr),
"query buffer tracing kind operation name");
if(name) name_info_v->kind_names[kind] = name;
if(kind == ROCPROFILER_BUFFER_TRACING_HSA_API)
{
ROCPROFILER_CALL(rocprofiler_iterate_buffer_tracing_kind_operations(
kind, tracing_kind_operation_cb, static_cast<void*>(data)),
"iterating buffer tracing kind operations");
}
return 0;
};
ROCPROFILER_CALL(rocprofiler_iterate_buffer_tracing_kinds(tracing_kind_cb,
static_cast<void*>(&cb_name_info)),
"iterating buffer tracing kinds");
return cb_name_info;
}
void
tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
rocprofiler_user_data_t* user_data,
@@ -566,6 +423,8 @@ TEST(rocprofiler_lib, buffer_registration_lambda_with_result)
static fini_func_t tool_fini = [](void* client_data) -> void {
auto* cb_data = static_cast<callback_data*>(client_data);
ROCPROFILER_CALL(rocprofiler_flush_buffer(cb_data->client_buffer),
"rocprofiler context stop failed");
ROCPROFILER_CALL(rocprofiler_stop_context(cb_data->client_ctx),
"rocprofiler context stop failed");
+1 -3
Voir le fichier
@@ -120,8 +120,6 @@ save(ArchiveT& ar, rocprofiler_callback_tracing_code_object_load_data_t data)
SAVE_DATA_FIELD(code_object_id);
SAVE_DATA_FIELD(rocp_agent);
SAVE_DATA_FIELD(hsa_agent);
SAVE_DATA_FIELD(rocp_agent);
SAVE_DATA_FIELD(hsa_agent);
SAVE_DATA_CSTR(uri);
SAVE_DATA_FIELD(load_base);
SAVE_DATA_FIELD(load_size);
@@ -210,7 +208,7 @@ save(ArchiveT& ar, rocprofiler_buffer_tracing_hip_api_record_t data)
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_buffer_tracing_marker_record_t data)
save(ArchiveT& ar, rocprofiler_buffer_tracing_marker_api_record_t data)
{
save_buffer_tracing_api_record(ar, data);
}