sdk Namespace Reference

sdk Namespace Reference#

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

Namespaces

namespace  category
 
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 >
 

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 72 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 97 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 101 of file perfetto.hpp.

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

145{
146 auto cb_name_info = buffer_name_info_t<Tp>{};
147 //
148 // callback for each kind operation
149 //
150 static auto tracing_kind_operation_cb =
151 [](rocprofiler_buffer_tracing_kind_t kindv, uint32_t operation, void* data_v) {
152 auto* name_info_v = static_cast<buffer_name_info_t<Tp>*>(data_v);
153
154 const char* name = nullptr;
156 kindv, operation, &name, nullptr);
157 if(status == success_v && name) name_info_v->emplace(kindv, operation, name);
158 return 0;
159 };
160
161 //
162 // callback for each buffer kind (i.e. domain)
163 //
164 static auto tracing_kind_cb = [](rocprofiler_buffer_tracing_kind_t kind, void* data) {
165 // store the buffer kind name
166 auto* name_info_v = static_cast<buffer_name_info_t<Tp>*>(data);
167 const char* name = nullptr;
168 auto status = rocprofiler_query_buffer_tracing_kind_name(kind, &name, nullptr);
169 if(status == success_v && name) name_info_v->emplace(kind, name);
170
171 rocprofiler_iterate_buffer_tracing_kind_operations(kind, tracing_kind_operation_cb, data);
172 return 0;
173 };
174
175 rocprofiler_iterate_buffer_tracing_kinds(tracing_kind_cb, &cb_name_info);
176
177 return cb_name_info;
178}
rocprofiler_buffer_tracing_kind_t
Service Buffer Tracing Kind.
Definition fwd.h:179
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, uint32_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 =
113 [](rocprofiler_callback_tracing_kind_t kindv, uint32_t operation, void* data_v) {
114 auto* name_info_v = static_cast<callback_name_info_t<Tp>*>(data_v);
115
116 const char* name = nullptr;
118 kindv, operation, &name, nullptr);
119 if(status == success_v && name) name_info_v->emplace(kindv, operation, name);
120 return 0;
121 };
122
123 //
124 // callback for each buffer kind (i.e. domain)
125 //
126 static auto tracing_kind_cb = [](rocprofiler_callback_tracing_kind_t kind, void* data) {
127 // store the buffer kind name
128 auto* name_info_v = static_cast<callback_name_info_t<Tp>*>(data);
129 const char* name = nullptr;
130 auto status = rocprofiler_query_callback_tracing_kind_name(kind, &name, nullptr);
131 if(status == success_v && name) name_info_v->emplace(kind, name);
132
133 rocprofiler_iterate_callback_tracing_kind_operations(kind, tracing_kind_operation_cb, data);
134 return 0;
135 };
136
137 rocprofiler_iterate_callback_tracing_kinds(tracing_kind_cb, &cb_name_info);
138
139 return cb_name_info;
140}
rocprofiler_callback_tracing_kind_t
Service Callback Tracing Kind.
Definition fwd.h:155
rocprofiler_status_t rocprofiler_query_callback_tracing_kind_operation_name(rocprofiler_callback_tracing_kind_t kind, uint32_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().