namespace lsu = lttng::sessiond::ust;
namespace {
-bool is_max_event_id(uint32_t id)
+bool is_max_event_id(lttng::sessiond::ust::event_id id)
{
return id == UINT32_MAX;
}
nonstd::optional<std::string> model_emf_uri,
lttng_buffer_type buffer_type,
const ust_app& app,
- uint32_t& out_event_id)
+ lsu::event_id& out_event_id)
{
- uint32_t event_id;
+ lsu::event_id event_id;
struct cds_lfht_node *nptr;
- lttng::urcu::read_lock_guard read_lock_guard;
+ const lttng::urcu::read_lock_guard read_lock_guard;
/*
* This should not happen but since it comes from the UST tracer, an
* external party, don't assert and simply validate values.
*/
if (session_objd < 0) {
- LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
+ LTTNG_THROW_INVALID_ARGUMENT_ERROR(lttng::format(
"Invalid session object descriptor provided by application: session descriptor = {}, app = {}",
session_objd,
app));
}
if (channel_objd < 0) {
- LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
+ LTTNG_THROW_INVALID_ARGUMENT_ERROR(lttng::format(
"Invalid channel object descriptor provided by application: channel descriptor = {}, app = {}",
channel_objd,
app));
/* Check if we've reached the maximum possible id. */
if (is_max_event_id(_next_event_id)) {
- LTTNG_THROW_ERROR(fmt::format(
+ LTTNG_THROW_ERROR(lttng::format(
"Failed to allocate new event id (id would overflow): app = {}", app));
}
loglevel_value,
std::move(model_emf_uri)));
- DBG3("%s", fmt::format("UST registry creating event: event = {}", *event).c_str());
+ DBG3("%s", lttng::format("UST registry creating event: event = {}", *event).c_str());
/*
* This is an add unique with a custom match function for event. The node
nptr, <tng::sessiond::ust::registry_event::_node);
event_id = existing_event->id;
} else {
- LTTNG_THROW_INVALID_ARGUMENT_ERROR(fmt::format(
+ LTTNG_THROW_INVALID_ARGUMENT_ERROR(lttng::format(
"UST registry create event add unique failed for event: event = {}",
*event));
}
void lsu::registry_channel::_accept_on_event_classes(
lttng::sessiond::trace::trace_class_visitor& visitor) const
{
- std::vector<const lttng::sessiond::ust::registry_event *> sorted_event_classes;
-
- {
- lttng::urcu::read_lock_guard read_lock_guard;
- struct lttng_ht_iter iter;
- const lttng::sessiond::ust::registry_event *event;
-
- DIAGNOSTIC_PUSH
- DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
- cds_lfht_for_each_entry (_events->ht, &iter.iter, event, _node) {
- sorted_event_classes.emplace_back(event);
- }
- DIAGNOSTIC_POP
- }
+ const lttng::urcu::lfht_iteration_adapter<lsu::registry_event,
+ decltype(lsu::registry_event::_node),
+ &lsu::registry_event::_node>
+ events_view(*_events->ht);
+
+ /* Copy the event ptrs from the _events ht to this vector which we'll sort. */
+ std::vector<const lttng::sessiond::ust::registry_event *> sorted_event_classes(
+ events_view.begin(), events_view.end());
std::sort(sorted_event_classes.begin(),
sorted_event_classes.end(),