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.
31 #include <type_traits>
53 template<
typename TTag = Generic>
78 Sector(std::string sector_name) : m_name{std::move(sector_name)}
95 Sector(std::string sector_name, std::string source, std::uint32_t lineno, std::string caller)
96 : m_name{std::move(sector_name)}
127 : m_name{std::move(other.m_name)}
128 , m_handle{std::exchange(other.m_handle,
nullptr)}
129 , m_entered{std::exchange(other.m_entered,
bool{})}
130 , m_summary{std::exchange(other.m_summary,
bool{})}
131 , m_on_enter{std::move(other.m_on_enter)}
132 , m_on_leave{std::move(other.m_on_leave)}
145 m_name = std::move(rhs.m_name);
146 m_handle = std::exchange(rhs.m_handle,
nullptr);
147 m_entered = std::exchange(rhs.m_entered,
bool{});
148 m_summary = std::exchange(rhs.m_summary,
bool{});
149 m_on_enter = std::move(rhs.m_on_enter);
150 m_on_leave = std::move(rhs.m_on_leave);
168 leave(__FILE__, __LINE__, __func__);
188 auto enter(std::string source, std::uint32_t lineno, std::string caller) ->
void
208 auto leave(std::string source, std::uint32_t lineno, std::string caller) ->
void
270 std::string m_name{
"BACTRIA_GENERIC_SECTOR"};
272 bool m_entered{
false};
273 bool m_summary{
false};
274 std::function<void(
void)> m_on_enter = []() {};
275 std::function<void(
void)> m_on_leave = []() {};
296 #define bactria_Sector(name, tag) \
297 ::bactria::metrics::Sector<tag> \
299 name, __FILE__, __LINE__, __func__ \
312 #define bactria_Enter(sec) sec.enter(__FILE__, __LINE__, __func__)
324 #define bactria_Leave(sec) sec.leave(__FILE__, __LINE__, __func__)
Sector(std::string sector_name, std::string source, std::uint32_t lineno, std::string caller)
The entering constructor.
Definition: Sector.hpp:95
~Sector()
The destructor.
Definition: Sector.hpp:163
auto on_leave(std::function< void(void)> f) -> void
Define a leave action.
Definition: Sector.hpp:263
auto on_enter(std::function< void(void)> f) -> void
Define an enter action.
Definition: Sector.hpp:246
auto leave(std::string source, std::uint32_t lineno, std::string caller) -> void
Leave the sector.
Definition: Sector.hpp:208
auto activated() -> bool
Checks for an active metrics plugin.
Definition: Plugin.hpp:58
auto create_sector(char const *name, std::uint32_t tag) noexcept
Creates a plugin-specific sector handle.
Definition: Plugin.hpp:231
auto destroy_sector(void *sector_handle) noexcept
Destroys a plugin-specific sector handle.
Definition: Plugin.hpp:246
auto enter(std::string source, std::uint32_t lineno, std::string caller) -> void
Enter the sector.
Definition: Sector.hpp:188
auto sector_summary(void *sector_handle) noexcept
Plugin-specific sector summary.
Definition: Plugin.hpp:293
auto summary() -> void
Summarize the Sector.
Definition: Sector.hpp:226
Sector()=default
The default constructor.
The sector class.
Definition: Sector.hpp:54
Sector(std::string sector_name)
The non-entering constructor.
Definition: Sector.hpp:78
auto leave_sector(void *sector_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept
Plugin-specific sector leaving.
Definition: Plugin.hpp:276
bactria-internal handling of metrics plugins.
auto operator=(Sector &&rhs) -> Sector &
The move assignment operator.
Definition: Sector.hpp:143
auto enter_sector(void *sector_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept
Plugin-specific sector entering.
Definition: Plugin.hpp:259
Sector(Sector &&other)
The move constructor.
Definition: Sector.hpp:126
auto operator=(Sector const &) -> Sector &=delete
The copy assignment operator (deleted).