bactria
0.0.1
The bactria library is a header-only C++14 library for profiling and tracing.
|
Go to the documentation of this file.
72 :
Marker(std::move(name), color, std::move(category))
86 , m_action{other.m_action}
106 m_action = rhs.m_action;
119 Event(
Event&& other) noexcept :
Marker(std::move(other)), m_handle{std::exchange(other.m_handle,
nullptr)}
121 std::swap(m_action, other.m_action);
135 m_handle = std::exchange(rhs.m_handle,
nullptr);
136 std::swap(m_action, rhs.m_action);
164 auto fire(std::string source, std::uint32_t lineno, std::string caller) noexcept ->
void
168 plugin::fire_event(m_handle, m_action().c_str(), source.c_str(), lineno, caller.c_str());
181 auto set_action(std::function<std::string(
void)> a) noexcept ->
void
183 m_action = std::move(a);
190 std::function<std::string(
void)> m_action = [
this]() {
return m_name; };
207 #define bactria_Event(name, color, category) \
209 auto e = bactria::ranges::Event(name, color, category); \
210 e.fire(__FILE__, __LINE__, __func__); \
225 #define bactria_ActionEvent(action, color, category) \
227 auto e = bactria::ranges::Event("BACTRIA_ACTION_EVENT", color, category); \
228 e.set_action(action); \
229 e.fire(__FILE__, __LINE__, __func__); \
Event(std::string name, std::uint32_t color=color::bactria_orange, Category category=Category{})
The constructor.
Definition: Event.hpp:71
Event(Event &&other) noexcept
The move constructor.
Definition: Event.hpp:119
auto get_id() const noexcept -> std::uint32_t
The ID getter method.
Definition: Category.hpp:110
Event(const Event &other)
The copy constructor.
Definition: Event.hpp:83
std::string m_name
The name assigned to the Marker.
Definition: Marker.hpp:177
constexpr auto bactria_orange
Definition: Colors.hpp:763
The abstract base class for markers.
Definition: Marker.hpp:50
std::uint32_t m_color
The color assigned to the Marker.
Definition: Marker.hpp:185
auto activated() -> bool
Checks for an active metrics plugin.
Definition: Plugin.hpp:58
Event()
The default constructor.
Definition: Event.hpp:57
Defines a category.
Definition: Category.hpp:39
The event class.
Definition: Event.hpp:48
auto operator=(const Event &rhs) -> Event &
The copy assignment operator.
Definition: Event.hpp:97
auto destroy_event(void *event_handle) noexcept
Destroys a plugin-specific event handle.
Definition: Plugin.hpp:223
auto set_action(std::function< std::string(void)> a) noexcept -> void
Set a user-defined action for generating the event name.
Definition: Event.hpp:181
bactria-internal handling of ranges plugins.
Category m_category
The Category assigned to the Marker.
Definition: Marker.hpp:193
auto create_event(std::uint32_t color, char const *cat_name, std::uint32_t cat_id) noexcept
Creates a plugin-specific event handle.
Definition: Plugin.hpp:205
~Event() override
The destructor.
Definition: Event.hpp:147
auto fire_event(void *event_handle, char const *event_name, char const *source, std::uint32_t lineno, char const *caller) noexcept
Plugin-specific event firing.
Definition: Plugin.hpp:236
auto operator=(Event &&rhs) noexcept -> Event &
The move assignment operator.
Definition: Event.hpp:132
auto fire(std::string source, std::uint32_t lineno, std::string caller) noexcept -> void
Fire the event.
Definition: Event.hpp:164
auto operator=(Marker const &rhs) -> Marker &=default
Copy-assignment operator.
auto get_c_name() const noexcept -> char const *
The C string name getter method.
Definition: Category.hpp:130
Marker()=default
Default constructor.