|
bactria
0.0.1
The bactria library is a header-only C++14 library for profiling and tracing.
|
The sector class. More...
#include <Sector.hpp>
Public Member Functions | |
| Sector ()=default | |
| The default constructor. More... | |
| Sector (std::string sector_name) | |
| The non-entering constructor. More... | |
| Sector (std::string sector_name, std::string source, std::uint32_t lineno, std::string caller) | |
| The entering constructor. More... | |
| Sector (Sector const &)=delete | |
| The copy constructor (deleted). More... | |
| auto | operator= (Sector const &) -> Sector &=delete |
| The copy assignment operator (deleted). More... | |
| Sector (Sector &&other) | |
| The move constructor. More... | |
| auto | operator= (Sector &&rhs) -> Sector & |
| The move assignment operator. More... | |
| ~Sector () | |
| The destructor. More... | |
| auto | enter (std::string source, std::uint32_t lineno, std::string caller) -> void |
| Enter the sector. More... | |
| auto | leave (std::string source, std::uint32_t lineno, std::string caller) -> void |
| Leave the sector. More... | |
| auto | summary () -> void |
| Summarize the Sector. More... | |
| auto | on_enter (std::function< void(void)> f) -> void |
| Define an enter action. More... | |
| auto | on_leave (std::function< void(void)> f) -> void |
| Define a leave action. More... | |
The sector class.
This class can be instantiated to instrument portions of the application code. The concrete metrics collected by this class are backend-specific.
|
default |
The default constructor.
The default constructor will generate a sector with the name BACTRIA_GENERIC_SECTOR. This sector will not be entered; this still needs to be done with a (correctly nested) pair of bactria_Enter() and bactria_Leave() or ~Sector().
|
inline |
The non-entering constructor.
The non-entering constructor will generate a sector with the name name. This sector will not be entered; this still needs to be done with a (correctly nested) pair of bactria_Enter() and bactria_Leave() or ~Sector().
| sector_name | The sector name as it should appear on the output file or visualizer. |
|
inline |
The entering constructor.
The entering constructor will generate a sector with the name name. This sector will be entered immediately. To leave it, the user can call bactria_Leave() or wait for ~Sector() to be triggered.
| sector_name | The sector name as it should appear on the output file or visualizer. |
| source | The source file this sector should be assigned to. This should be __FILE__. |
| lineno | The line number of the source file. This should be __LINE__. |
| caller | The surrounding function this sector is constructed in. This should be __func__. |
|
delete |
The copy constructor (deleted).
Sectors are not intended to be copied. Thus, the copy constructor is deleted.
|
inline |
The move constructor.
Moves the other sector into this sector.
| other | The sector to be moved. |
|
inline |
The destructor.
Destructs the sector. If the sector was entered and there was no preceeding call to bactria_Leave() or leave() the destructor will trigger this functionality before the contents of this are deleted.
|
inline |
Enter the sector.
Enters the sector. It is not allowed to enter a sector multiple times without a prior call to leave(). Each call to enter() has to be correctly nested with a corresponding call to leave() or ~Sector().
| source | The source file where the sector is entered. This should be __FILE__. |
| lineno | The source line where the sector is entered. This should be __LINE__. |
| caller | The function where the sector is entered. This should be __func__. |
|
inline |
Leave the sector.
Leaves the sector.
| source | The source file where the sector is left. This should be __FILE__. |
| lineno | The source line where the sector is left. This should be __LINE__. |
| caller | The function where the sector is left. This should be __func__. |
|
inline |
Define an enter action.
Defines an action which is executed after the Sector is entered. This allows for injecting user-defined actions that alter program behaviour, such as issuing asynchronous functions. Actions will not be executed if bactria has been deactivated by setting the environment variable BACTRIA_DEACTIVATE.
| [in] | f | The action to be executed after entering the Sector. |
|
inline |
Define a leave action.
Defines an action which is executed before the Sector is left. This allows for injecting user-defined actions that alter program behaviour, such as synchronization of asynchronous functions. Actions will not be executed if bactria has been deactivated by setting the environment variable BACTRIA_DEACTIVATE.
| [in] | f | The action to be executed before leaving the Sector. |
|
inline |
The move assignment operator.
Moves the rhs sector into this sector.
| rhs | The sector to be moved. |
|
delete |
The copy assignment operator (deleted).
Sectors are not intended to be copied. Thus, the copy assignment operator is deleted.
|
inline |
Summarize the Sector.
Summarizes the Sector's metrics. The exact metrics depend on the back-end. This function is mostly useful for Sectors with the Body tag which allows the back-end to evaluate the individual iterations and generate statistics for the overall loop. If this method has not been called before destruction, the destructor will call this internally.