fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
[lttng-tools.git] / src / bin / lttng-sessiond / ust-registry-event.hpp
1 /*
2 * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef LTTNG_UST_REGISTRY_EVENT_H
9 #define LTTNG_UST_REGISTRY_EVENT_H
10
11 #include "event-class.hpp"
12 #include "field.hpp"
13
14 #include <common/format.hpp>
15 #include <common/hashtable/hashtable.hpp>
16
17 #include <vendor/optional.hpp>
18
19 #include <typeinfo>
20
21 namespace lttng {
22 namespace sessiond {
23 namespace ust {
24
25 /*
26 * Event registered from a UST tracer sent to the session daemon. This is
27 * indexed and matched by <event_name/signature>.
28 */
29 class registry_event : public lttng::sessiond::trace::event_class {
30 public:
31 registry_event(unsigned int id,
32 unsigned int stream_class_id,
33 int session_objd,
34 int channel_objd,
35 std::string name,
36 std::string signature,
37 std::vector<lttng::sessiond::trace::field::cuptr> fields,
38 int loglevel_value,
39 nonstd::optional<std::string> model_emf_uri);
40 ~registry_event() override = default;
41 registry_event(const registry_event&) = delete;
42 registry_event(registry_event&&) = delete;
43 registry_event& operator=(registry_event&&) = delete;
44 registry_event& operator=(const registry_event&) = delete;
45
46 /* Both objd are set by the tracer. */
47 const int session_objd;
48 const int channel_objd;
49 const std::string signature;
50
51 /*
52 * Flag for this channel if the metadata was dumped once during
53 * registration.
54 */
55 bool _metadata_dumped;
56
57 /*
58 * Node in the ust-registry hash table. The event name is used to
59 * initialize the node and the event_name/signature for the match function.
60 */
61 struct cds_lfht_node _node;
62 struct rcu_head _head;
63 };
64
65 void registry_event_destroy(registry_event *event);
66
67 } /* namespace ust */
68 } /* namespace sessiond */
69 } /* namespace lttng */
70
71 /*
72 * Due to a bug in g++ < 7.1, this specialization must be enclosed in the fmt namespace,
73 * see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480.
74 */
75 namespace fmt {
76 template <>
77 struct formatter<lttng::sessiond::ust::registry_event> : formatter<std::string> {
78 template <typename FormatContextType>
79 typename FormatContextType::iterator
80 format(const lttng::sessiond::ust::registry_event& event, FormatContextType& ctx)
81 {
82 return format_to(
83 ctx.out(),
84 "{{ name = `{}`, signature = `{}`, id = {}, session objd = {}, channel objd = {} }}",
85 event.name,
86 event.signature,
87 event.id,
88 event.session_objd,
89 event.channel_objd);
90 }
91 };
92 } /* namespace fmt */
93
94 #endif /* LTTNG_UST_REGISTRY_EVENT_H */
This page took 0.031147 seconds and 4 git commands to generate.