bactria  0.0.1
The bactria library is a header-only C++14 library for profiling and tracing.
Plugin interface
Collaboration diagram for Plugin interface:

Functions

auto bactria_metrics_create_sector (char const *name, std::uint32_t type) noexcept -> void *
 Creates a sector handle. More...
 
auto bactria_metrics_destroy_sector (void *sector_handle) noexcept -> void
 Destroys a sector handle. More...
 
auto bactria_metrics_enter_sector (void *sector_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept -> void
 Enter a sector. More...
 
auto bactria_metrics_leave_sector (void *sector_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept -> void
 Leave a sector. More...
 
auto bactria_metrics_sector_summary (void *sector_handle) noexcept -> void
 Summarize a sector. More...
 
auto bactria_metrics_create_phase (char const *name) noexcept -> void *
 Create a phase handle. More...
 
auto bactria_metrics_destroy_phase (void *phase_handle) noexcept -> void
 Destroy a phase handle. More...
 
auto bactria_metrics_enter_phase (void *phase_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept -> void
 Enter a phase. More...
 
auto bactria_metrics_leave_phase (void *phase_handle, char const *source, std::uint32_t lineno, char const *caller) noexcept -> void
 Leave a phase. More...
 

Detailed Description

This is the interface for a metrics plugin. Plugin developers should include metrics/PluginInterface.hpp and implement all functions listed here.

Function Documentation

◆ bactria_metrics_create_phase()

auto bactria_metrics_create_phase ( char const *  name) -> void *
noexcept

Create a phase handle.

Creates a plugin-specific phase handle. This is called internally by bactria::Phase::Phase().

Parameters
[in]nameThe phase name as it should appear in the output.
Returns
A plugin-specific phase handle.
See also
bactria_metrics_destroy_phase(), bactria_metrics_enter_phase(), bactria_metrics_leave_phase()

◆ bactria_metrics_create_sector()

auto bactria_metrics_create_sector ( char const *  name,
std::uint32_t  type 
) -> void *
noexcept

Creates a sector handle.

This function creates a plugin-specific sector handle. This is internally used by bactria::Sector to communicate with the plugin. Each bactria::Sector encapsulates its own sector handle.

Parameters
[in]nameThe name of the sector (as it should appear in the output).
[in]typeThe type of the sector. See Tags.hpp for the possible values.
Returns
A handle to the plugin-specific sector.
See also
bactria_metrics_destroy_sector(), bactria_metrics_enter_sector(), bactria_metrics_leave_sector(), bactria_metrics_sector_summary()

◆ bactria_metrics_destroy_phase()

auto bactria_metrics_destroy_phase ( void *  phase_handle) -> void
noexcept

Destroy a phase handle.

Destroys a plugin-specific phase handle. This is called internally by bactria::Phase::~Phase(). The phase handle must not be used after the call unless it has been reinitialized by a call to bactria_metrics_create_phase().

Parameters
[in]phase_handleThe phase handle created by bactria_metrics_create_phase().
See also
bactria_metrics_create_phase(), bactria_metrics_enter_phase(), bactria_metrics_leave_phase()

◆ bactria_metrics_destroy_sector()

auto bactria_metrics_destroy_sector ( void *  sector_handle) -> void
noexcept

Destroys a sector handle.

Destroys a plugin-specific sector handle. This is internally called by bactria::Sector::~Sector(). The sector_handle must not be used after the call unless it has been reinitialized with bactria_metrics_create_sector().

Parameters
[in]sector_handleThe sector handle created by bactria_metrics_create_sector().
See also
bactria_metrics_create_sector(), bactria_metrics_enter_sector(), bactria_metrics_leave_sector(), bactria_metrics_sector_summary()

◆ bactria_metrics_enter_phase()

auto bactria_metrics_enter_phase ( void *  phase_handle,
char const *  source,
std::uint32_t  lineno,
char const *  caller 
) -> void
noexcept

Enter a phase.

Enters the plugin-specific phase. It is called internally by bactria::Phase::enter().

Parameters
[in,out]phase_handleThe phase handle created by bactria_metrics_create_phase().
[in]sourceThe source file of the call to bactria::Phase::enter().
[in]linenoThe source line of the call to bactria::Phase::enter().
[in]callerThe surrounding function of the call to bactria::Phase::enter().
See also
bactria_metrics_create_phase(), bactria_metrics_destroy_phase(), bactria_metrics_leave_phase()

◆ bactria_metrics_enter_sector()

auto bactria_metrics_enter_sector ( void *  sector_handle,
char const *  source,
std::uint32_t  lineno,
char const *  caller 
) -> void
noexcept

Enter a sector.

Enters the plugin-specific sector. It is called internally by bactria::Sector::enter().

Parameters
[in,out]sector_handleThe sector handle created by bactria_metrics_create_sector().
[in]sourceThe source file of the call to bactria::Sector::enter().
[in]linenoThe source line of the call to bactria::Sector::enter().
[in]callerThe surrounding function of the call to bactria::Sector::enter().
See also
bactria_metrics_create_sector(), bactria_metrics_destroy_sector(), bactria_metrics_leave_sector(), bactria_metrics_sector_summary()

◆ bactria_metrics_leave_phase()

auto bactria_metrics_leave_phase ( void *  phase_handle,
char const *  source,
std::uint32_t  lineno,
char const *  caller 
) -> void
noexcept

Leave a phase.

Leaves the plugin-specific sector. It is called internally by bactria::Phase::leave().

Parameters
[in,out]phase_handleThe phase handle created by bactria_metrics_create_phase().
[in]sourceThe source file of the call to bactria::Phase::leave().
[in]linenoThe source line of the call to bactria::Phase::leave().
[in]callerThe surrounding function of the call to bactria::Phase::leave().
See also
bactria_metrics_create_phase(), bactria_metrics_destroy_phase(), bactria_metrics_enter_phase()

◆ bactria_metrics_leave_sector()

auto bactria_metrics_leave_sector ( void *  sector_handle,
char const *  source,
std::uint32_t  lineno,
char const *  caller 
) -> void
noexcept

Leave a sector.

Leaves the plugin-specific sector. It is called internally by bactria::Sector::leave().

Parameters
[in,out]sector_handleThe sector handle created by bactria_metrics_create_sector().
[in]sourceThe source file of the call to bactria::Sector::leave().
[in]linenoThe source line of the call to bactria::Sector::leave().
[in]callerThe surrounding function of the call to bactria::Sector::leave().
See also
bactria_metrics_create_sector(), bactria_metrics_destroy_sector(), bactria_metrics_enter_sector(), bactria_metrics_sector_summary()

◆ bactria_metrics_sector_summary()

auto bactria_metrics_sector_summary ( void *  sector_handle) -> void
noexcept

Summarize a sector.

Flushes the sector summary. This is called internally by bactria::Sector::summary() or by bactria::Sector::~Sector() if bactria::Sector::summary() has not been called before.

Parameters
[in,out]sector_handleThe sector handle created by bactria_metrics_create_sector().
See also
bactria_metrics_create_sector(), bactria_metrics_destroy_sector(), bactria_metrics_enter_sector(), bactria_metrics_leave_sector()