sdk Namespace Reference

sdk Namespace Reference#

Rocprofiler SDK Developer API: rocprofiler::sdk Namespace Reference
Rocprofiler SDK Developer API 0.5.0
ROCm Profiling API and tools
rocprofiler::sdk Namespace Reference

Namespaces

namespace  category
 
namespace  codeobj
 
namespace  hash
 
namespace  join
 
namespace  mpl
 
namespace  operators
 
namespace  parse
 
namespace  utility
 

Data Structures

struct  perfetto_category
 
struct  perfetto_category< category ::hip_api >
 
struct  perfetto_category< category ::hsa_api >
 
struct  perfetto_category< category ::kernel_dispatch >
 
struct  perfetto_category< category ::marker_api >
 
struct  perfetto_category< category ::memory_copy >
 
struct  perfetto_category< category ::rccl_api >
 

Typedefs

template<typename Tp = std::string_view>
using callback_name_info_t = utility::name_info< rocprofiler_callback_tracing_kind_t, Tp >
 
template<typename Tp = std::string_view>
using buffer_name_info_t = utility::name_info< rocprofiler_buffer_tracing_kind_t, Tp >
 
using callback_name_info = callback_name_info_t< std::string_view >
 
using buffer_name_info = buffer_name_info_t< std::string_view >
 
using perfetto_event_context_t = ::perfetto::EventContext
 

Functions

template<typename Tp >
callback_name_info_t< Tp > get_callback_tracing_names ()
 
template<typename Tp >
buffer_name_info_t< Tp > get_buffer_tracing_names ()
 
template<typename Np , typename Tp >
auto add_perfetto_annotation (perfetto_event_context_t &ctx, Np &&_name, Tp &&_val)
 

Variables

constexpr auto success_v = ROCPROFILER_STATUS_SUCCESS
 

Data Structure Documentation

◆ rocprofiler::sdk::perfetto_category

struct rocprofiler::sdk::perfetto_category
template<typename Tp>
struct rocprofiler::sdk::perfetto_category< Tp >

Definition at line 73 of file perfetto.hpp.

+ Collaboration diagram for rocprofiler::sdk::perfetto_category< Tp >:

Typedef Documentation

◆ buffer_name_info

using rocprofiler::sdk::buffer_name_info = typedef buffer_name_info_t<std::string_view>

Definition at line 103 of file name_info.hpp.

◆ buffer_name_info_t

template<typename Tp = std::string_view>
using rocprofiler::sdk::buffer_name_info_t = typedef utility::name_info<rocprofiler_buffer_tracing_kind_t, Tp>

Definition at line 100 of file name_info.hpp.

◆ callback_name_info

Definition at line 102 of file name_info.hpp.

◆ callback_name_info_t

template<typename Tp = std::string_view>
using rocprofiler::sdk::callback_name_info_t = typedef utility::name_info<rocprofiler_callback_tracing_kind_t, Tp>

Definition at line 97 of file name_info.hpp.

◆ perfetto_event_context_t

using rocprofiler::sdk::perfetto_event_context_t = typedef ::perfetto::EventContext

Definition at line 100 of file perfetto.hpp.

Function Documentation

◆ add_perfetto_annotation()

template<typename Np , typename Tp >
auto rocprofiler::sdk::add_perfetto_annotation ( perfetto_event_context_t ctx,
Np &&  _name,
Tp &&  _val 
)

Definition at line 104 of file perfetto.hpp.

105{
106 namespace mpl = ::rocprofiler::sdk::mpl;
107
108 using named_type = mpl::unqualified_identity_t<Np>;
109 using value_type = mpl::unqualified_identity_t<Tp>;
110
111 static_assert(mpl::is_string_type<named_type>::value, "Error! name is not a string type");
112
113 auto _get_dbg = [&]() {
114 auto* _dbg = ctx.event()->add_debug_annotations();
115 _dbg->set_name(std::string_view{std::forward<Np>(_name)}.data());
116 return _dbg;
117 };
118
119 if constexpr(std::is_same<value_type, std::string_view>::value)
120 {
121 _get_dbg()->set_string_value(_val.data());
122 }
123 else if constexpr(mpl::is_string_type<value_type>::value)
124 {
125 _get_dbg()->set_string_value(std::forward<Tp>(_val));
126 }
127 else if constexpr(std::is_same<value_type, bool>::value)
128 {
129 _get_dbg()->set_bool_value(_val);
130 }
131 else if constexpr(std::is_enum<value_type>::value)
132 {
133 _get_dbg()->set_int_value(static_cast<int64_t>(_val));
134 }
135 else if constexpr(std::is_floating_point<value_type>::value)
136 {
137 _get_dbg()->set_double_value(static_cast<double>(_val));
138 }
139 else if constexpr(std::is_integral<value_type>::value)
140 {
141 if constexpr(std::is_unsigned<value_type>::value)
142 {
143 _get_dbg()->set_uint_value(_val);
144 }
145 else
146 {
147 _get_dbg()->set_int_value(_val);
148 }
149 }
150 else if constexpr(std::is_pointer<value_type>::value)
151 {
152 _get_dbg()->set_pointer_value(reinterpret_cast<uint64_t>(_val));
153 }
154 else if constexpr(mpl::can_stringify<value_type>::value)
155 {
156 auto _ss = std::stringstream{};
157 _ss << std::forward<Tp>(_val);
158 _get_dbg()->set_string_value(_ss.str());
159 }
160 else
161 {
162 static_assert(std::is_empty<value_type>::value, "Error! unsupported data type");
163 }
164}
typename unqualified_identity< Tp >::type unqualified_identity_t
Definition mpl.hpp:74

◆ get_buffer_tracing_names()

template<typename Tp >
buffer_name_info_t< Tp > rocprofiler::sdk::get_buffer_tracing_names ( )
inline

Definition at line 145 of file name_info.hpp.

146{
147 auto cb_name_info = buffer_name_info_t<Tp>{};
148 //
149 // callback for each kind operation
150 //
151 static auto tracing_kind_operation_cb = [](rocprofiler_buffer_tracing_kind_t kindv,
153 void* data_v) {
154 auto* name_info_v = static_cast<buffer_name_info_t<Tp>*>(data_v);
155
156 const char* name = nullptr;
157 auto status =
158 rocprofiler_query_buffer_tracing_kind_operation_name(kindv, operation, &name, nullptr);
159 if(status == success_v && name) name_info_v->emplace(kindv, operation, name);
160 return 0;
161 };
162
163 //
164 // callback for each buffer kind (i.e. domain)
165 //
166 static auto tracing_kind_cb = [](rocprofiler_buffer_tracing_kind_t kind, void* data) {
167 // store the buffer kind name
168 auto* name_info_v = static_cast<buffer_name_info_t<Tp>*>(data);
169 const char* name = nullptr;
170 auto status = rocprofiler_query_buffer_tracing_kind_name(kind, &name, nullptr);
171 if(status == success_v && name) name_info_v->emplace(kind, name);
172
173 rocprofiler_iterate_buffer_tracing_kind_operations(kind, tracing_kind_operation_cb, data);
174 return 0;
175 };
176
177 rocprofiler_iterate_buffer_tracing_kinds(tracing_kind_cb, &cb_name_info);
178
179 return cb_name_info;
180}
int32_t rocprofiler_tracing_operation_t
Tracing Operation ID. Depending on the kind, operations can be determined. If the value is equal to z...
Definition fwd.h:452
rocprofiler_buffer_tracing_kind_t
Service Buffer Tracing Kind.
Definition fwd.h:182
rocprofiler_status_t rocprofiler_iterate_buffer_tracing_kinds(rocprofiler_buffer_tracing_kind_cb_t callback, void *data)
Iterate over all the buffer tracing kinds and invokes the callback for each buffer tracing kind.
rocprofiler_status_t rocprofiler_query_buffer_tracing_kind_name(rocprofiler_buffer_tracing_kind_t kind, const char **name, uint64_t *name_len)
Query the name of the buffer tracing kind. The name retrieved from this function is a string literal ...
rocprofiler_status_t rocprofiler_query_buffer_tracing_kind_operation_name(rocprofiler_buffer_tracing_kind_t kind, rocprofiler_tracing_operation_t operation, const char **name, uint64_t *name_len)
Query the name of the buffer tracing kind. The name retrieved from this function is a string literal ...
rocprofiler_status_t rocprofiler_iterate_buffer_tracing_kind_operations(rocprofiler_buffer_tracing_kind_t kind, rocprofiler_buffer_tracing_kind_operation_cb_t callback, void *data)
Iterates over all the operations for a given rocprofiler_buffer_tracing_kind_t and invokes the callba...

References rocprofiler_iterate_buffer_tracing_kind_operations(), rocprofiler_iterate_buffer_tracing_kinds(), rocprofiler_query_buffer_tracing_kind_name(), rocprofiler_query_buffer_tracing_kind_operation_name(), and success_v.

+ Here is the call graph for this function:

◆ get_callback_tracing_names()

template<typename Tp >
callback_name_info_t< Tp > rocprofiler::sdk::get_callback_tracing_names ( )
inline

Definition at line 106 of file name_info.hpp.

107{
108 auto cb_name_info = callback_name_info_t<Tp>{};
109 //
110 // callback for each kind operation
111 //
112 static auto tracing_kind_operation_cb = [](rocprofiler_callback_tracing_kind_t kindv,
114 void* data_v) {
115 auto* name_info_v = static_cast<callback_name_info_t<Tp>*>(data_v);
116
117 const char* name = nullptr;
119 kindv, operation, &name, nullptr);
120 if(status == success_v && name) name_info_v->emplace(kindv, operation, name);
121 return 0;
122 };
123
124 //
125 // callback for each buffer kind (i.e. domain)
126 //
127 static auto tracing_kind_cb = [](rocprofiler_callback_tracing_kind_t kind, void* data) {
128 // store the buffer kind name
129 auto* name_info_v = static_cast<callback_name_info_t<Tp>*>(data);
130 const char* name = nullptr;
131 auto status = rocprofiler_query_callback_tracing_kind_name(kind, &name, nullptr);
132 if(status == success_v && name) name_info_v->emplace(kind, name);
133
134 rocprofiler_iterate_callback_tracing_kind_operations(kind, tracing_kind_operation_cb, data);
135 return 0;
136 };
137
138 rocprofiler_iterate_callback_tracing_kinds(tracing_kind_cb, &cb_name_info);
139
140 return cb_name_info;
141}
rocprofiler_callback_tracing_kind_t
Service Callback Tracing Kind.
Definition fwd.h:157
rocprofiler_status_t rocprofiler_query_callback_tracing_kind_operation_name(rocprofiler_callback_tracing_kind_t kind, rocprofiler_tracing_operation_t operation, const char **name, uint64_t *name_len)
Query the name of the callback tracing kind. The name retrieved from this function is a string litera...
rocprofiler_status_t rocprofiler_query_callback_tracing_kind_name(rocprofiler_callback_tracing_kind_t kind, const char **name, uint64_t *name_len)
Query the name of the callback tracing kind. The name retrieved from this function is a string litera...
rocprofiler_status_t rocprofiler_iterate_callback_tracing_kind_operations(rocprofiler_callback_tracing_kind_t kind, rocprofiler_callback_tracing_kind_operation_cb_t callback, void *data)
Iterates over all the mappings of the operations for a given rocprofiler_callback_tracing_kind_t and ...
rocprofiler_status_t rocprofiler_iterate_callback_tracing_kinds(rocprofiler_callback_tracing_kind_cb_t callback, void *data)
Iterate over all the mappings of the callback tracing kinds and get a callback for each kind.

References rocprofiler_iterate_callback_tracing_kind_operations(), rocprofiler_iterate_callback_tracing_kinds(), rocprofiler_query_callback_tracing_kind_name(), rocprofiler_query_callback_tracing_kind_operation_name(), and success_v.

+ Here is the call graph for this function:

Variable Documentation

◆ success_v

constexpr auto rocprofiler::sdk::success_v = ROCPROFILER_STATUS_SUCCESS
constexpr

Definition at line 102 of file name_info.hpp.

Referenced by get_buffer_tracing_names(), and get_callback_tracing_names().