|
KASKADE 7 development version
|
A scope guard object that automatically closes a timing section on destruction. More...
#include <timing.hh>
A scope guard object that automatically closes a timing section on destruction.
This closes timing sections in case an exception is thrown.
Example:
Public Member Functions | |
| ScopedTimingSection () | |
| Default constructor creating a not-running unnamed section. More... | |
| ScopedTimingSection (ScopedTimingSection const &)=delete | |
| ScopedTimingSection (Timings_Details::SectionBeacon const &sec) | |
| Move constructor. More... | |
| ScopedTimingSection (std::string const &name, bool gather=true) | |
| Constructor using the default timer provided by Timings::instance(). More... | |
| ScopedTimingSection (std::string const &name, Timings &timer, bool gather=true) | |
| Constructor using provided timer. More... | |
| ~ScopedTimingSection () | |
| void | restart (std::string const &name) |
| Start new section. More... | |
| ScopedTimingSection & | operator= (Timings_Details::SectionBeacon const &sec) |
| Assignment from a beacon. More... | |
| void | start () |
| Ensures the section is timed. More... | |
| void | stop () |
| Ensures the section is not timed. More... | |
| bool | isRunning () const |
| Reports whether the section is currently timed. More... | |
| Timings & | timer () |
| Returns the used timer. More... | |
| Kaskade::ScopedTimingSection::ScopedTimingSection | ( | ) |
Default constructor creating a not-running unnamed section.
|
delete |
| Kaskade::ScopedTimingSection::ScopedTimingSection | ( | Timings_Details::SectionBeacon const & | sec | ) |
Move constructor.
This moves the given section to the created one, leaving the given section with empty name, not running, not gathering.
| Kaskade::ScopedTimingSection::ScopedTimingSection | ( | std::string const & | name, |
| bool | gather = true |
||
| ) |
Constructor using the default timer provided by Timings::instance().
| name | the name of the section to be timed. |
| gather | if false, do not gather any timings. This can be used to switch off timing collection in potentially multithreaded environments, while at the same time use ScopedTimingSection guards. The timer is started immediately. |
| Kaskade::ScopedTimingSection::ScopedTimingSection | ( | std::string const & | name, |
| Timings & | timer, | ||
| bool | gather = true |
||
| ) |
Constructor using provided timer.
| timer | a timer. This has to exist during the lifetime of the scoped timing section. |
The timer is started immediately.
| Kaskade::ScopedTimingSection::~ScopedTimingSection | ( | ) |
| bool Kaskade::ScopedTimingSection::isRunning | ( | ) | const |
Reports whether the section is currently timed.
| ScopedTimingSection & Kaskade::ScopedTimingSection::operator= | ( | Timings_Details::SectionBeacon const & | sec | ) |
Assignment from a beacon.
If the section is running, it is implicitly stopped by the assignment.
| void Kaskade::ScopedTimingSection::restart | ( | std::string const & | name | ) |
Start new section.
If the section is running, it is implicitly stopped before the newly named section is started.
| void Kaskade::ScopedTimingSection::start | ( | ) |
Ensures the section is timed.
If the timer is not running, it is started (unless gather is set to false). Otherwise nothing is done. A running section is stopped if assigned to.
| void Kaskade::ScopedTimingSection::stop | ( | ) |
Ensures the section is not timed.
If the timer is running, it is stopped. Otherwise nothing is done.
| Timings & Kaskade::ScopedTimingSection::timer | ( | ) |
Returns the used timer.
Referenced by Kaskade::BDDC::matrixDomainDecommposition(), and Kaskade::uniformEmbeddedErrorEstimation().