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>
60 static bool const activated =
is_active() && (std::getenv(
"BACTRIA_METRICS_PLUGIN") !=
nullptr);
70 using create_sector_t = std::add_pointer_t<
void*(
char const*, std::uint32_t) noexcept>;
98 using enter_sector_t = std::add_pointer_t<void(
void*,
char const*, std::uint32_t,
char const*) noexcept>;
112 using leave_sector_t = std::add_pointer_t<void(
void*,
char const*, std::uint32_t,
char const*) noexcept>;
168 using enter_phase_t = std::add_pointer_t<void(
void*,
char const*, std::uint32_t,
char const*) noexcept>;
182 using leave_phase_t = std::add_pointer_t<void(
void*,
char const*, std::uint32_t,
char const*) noexcept>;
201 auto const path = std::getenv(
"BACTRIA_METRICS_PLUGIN");
221 throw std::runtime_error{std::string{
"Failed to load bactria metrics plugin "} + path};
231 [[nodiscard, gnu::always_inline]]
inline auto create_sector(
char const* name, std::uint32_t tag) noexcept
236 return static_cast<void*
>(
nullptr);
262 std::uint32_t lineno,
263 char const* caller) noexcept
279 std::uint32_t lineno,
280 char const* caller) noexcept
307 [[nodiscard, gnu::always_inline]]
inline auto create_phase(
char const* name) noexcept
312 return static_cast<void*
>(
nullptr);
322 [[gnu::always_inline]]
inline auto destroy_phase(
void* phase_handle) noexcept
338 std::uint32_t lineno,
339 char const* caller) noexcept
355 std::uint32_t lineno,
356 char const* caller) noexcept
auto enter_phase_ptr
Pointer to plugin function bactria_metrics_enter_phase().
Definition: Plugin.hpp:175
bactria-internal plugin handling.
std::add_pointer_t< void(void *) noexcept > sector_summary_t
Signature for plugin function bactria_metrics_sector_summary().
Definition: Plugin.hpp:126
std::add_pointer_t< void(void *) noexcept > destroy_phase_t
Signature for plugin function bactria_metrics_destroy_phase().
Definition: Plugin.hpp:154
auto destroy_sector_ptr
Pointer to plugin function bactria_metrics_destroy_sector().
Definition: Plugin.hpp:91
auto is_active() -> bool
Checks whether the bactria library has been deactivated by the user.
Definition: Activation.hpp:52
auto create_phase(char const *name) noexcept
Creates a plugin-specific phase handle.
Definition: Plugin.hpp:307
auto leave_phase_ptr
Pointer to plugin function bactria_metrics_leave_phase().
Definition: Plugin.hpp:189
auto create_sector(char const *name, std::uint32_t tag) noexcept
Creates a plugin-specific sector handle.
Definition: Plugin.hpp:231
auto create_sector_ptr
Pointer to plugin function bactria_metrics_create_sector().
Definition: Plugin.hpp:77
auto destroy_sector(void *sector_handle) noexcept
Destroys a plugin-specific sector handle.
Definition: Plugin.hpp:246
auto sector_summary_ptr
Pointer to plugin function bactria_metrics_sector_summary().
Definition: Plugin.hpp:133
std::add_pointer_t< void(void *, char const *, std::uint32_t, char const *) noexcept > enter_sector_t
Signature for plugin function bactria_metrics_enter_sector().
Definition: Plugin.hpp:98
auto enter_sector_ptr
Pointer to plugin function bactria_metrics_enter_sector().
Definition: Plugin.hpp:105
std::add_pointer_t< void(void *, char const *, std::uint32_t, char const *) noexcept > leave_phase_t
Signature for plugin function bactria_metrics_leave_phase().
Definition: Plugin.hpp:182
std::add_pointer_t< void *(char const *, std::uint32_t) noexcept > create_sector_t
Signature for plugin function bactria_metrics_create_sector().
Definition: Plugin.hpp:70
auto destroy_phase(void *phase_handle) noexcept
Destroys a plugin-specific phase handle.
Definition: Plugin.hpp:322
auto leave_sector_ptr
Pointer to plugin function bactria_metrics_leave_sector().
Definition: Plugin.hpp:119
auto load_func(plugin_handle_t handle, Sig &ptr, const char *name)
The POSIX-specific function loader.
Definition: POSIX.hpp:80
auto activated() -> bool
Checks for an active reports plugin.
Definition: Plugin.hpp:60
auto sector_summary(void *sector_handle) noexcept
Plugin-specific sector summary.
Definition: Plugin.hpp:293
auto open_plugin(const char *path)
The POSIX-specific plugin loader.
Definition: POSIX.hpp:57
auto leave_phase(void *phase_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept
Plugin-specific phase leaving.
Definition: Plugin.hpp:352
system::plugin_handle_t plugin_handle_t
The platform-specific plugin handle type.
Definition: Plugin.hpp:41
auto create_phase_ptr
Pointer to plugin function bactria_metrics_create_phase().
Definition: Plugin.hpp:147
std::add_pointer_t< void(void *, char const *, std::uint32_t, char const *) noexcept > leave_sector_t
Signature for plugin function bactria_metrics_leave_sector().
Definition: Plugin.hpp:112
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
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
std::add_pointer_t< void(void *) noexcept > destroy_sector_t
Signature for plugin function bactria_metrics_destroy_sector().
Definition: Plugin.hpp:84
auto load() -> plugin_handle_t
Initializes the reports plugin.
Definition: Plugin.hpp:285
std::add_pointer_t< void *(char const *) noexcept > create_phase_t
Signature for plugin function bactria_metrics_create_phase().
Definition: Plugin.hpp:140
std::add_pointer_t< void(void *, char const *, std::uint32_t, char const *) noexcept > enter_phase_t
Signature for plugin function bactria_metrics_enter_phase().
Definition: Plugin.hpp:168
auto enter_phase(void *phase_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept
Plugin-specific phase entering.
Definition: Plugin.hpp:335
auto destroy_phase_ptr
Pointer to plugin function bactria_metrics_destroy_phase().
Definition: Plugin.hpp:161