KASKADE 7 development version
|
Supports gathering and reporting execution times information for nested program parts. More...
#include <timing.hh>
Supports gathering and reporting execution times information for nested program parts.
Entering and leaving timed regions incurs a (small but measurable) overhead. Thus, the timed regions should not be too quick. E.g., local assembly on a single cell is too fast for providing reasonably accurate timings.
While calling the methods is thread-safe, using it from within parallelized loops will lead to errors such as stopping a section that is currently not running (because in a different thread some other section has just been started). If needed, one timer per thread can be used.
Example:
Public Member Functions | |
Timings () | |
Constructor. More... | |
std::ostream & | report (std::ostream &out, int maxlevel=1000) const |
Prints a timing report to the given stream. More... | |
Timings_Details::SectionBeacon | startSection (std::string const &name) |
Provides a beacon to handing over to ScopedTimingSection for starting a section. More... | |
struct Times const * | start (std::string const &name) |
Starts or continues the timing of given section. More... | |
void | stop (std::string const &name) |
Stops the timing of given section. More... | |
void | stop (struct Times const *ticket=nullptr) |
Stops the timing of given section. More... | |
void | clear () |
Resets the timer to an empty state. More... | |
~Timings () | |
Static Public Member Functions | |
static Timings & | instance () |
Returns a reference to a single default instance. More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &out, Timings const &timings) |
write a timing report to a stream More... | |
Kaskade::Timings::Timings | ( | ) |
Constructor.
Kaskade::Timings::~Timings | ( | ) |
void Kaskade::Timings::clear | ( | ) |
Resets the timer to an empty state.
|
static |
Returns a reference to a single default instance.
Referenced by Kaskade::GridManagerBase< Grd >::adapt(), Kaskade::VariationalFunctionalAssembler< F, SparseIndex, BoundaryDetector, QuadRule >::assemble(), Kaskade::NumaBCRSMatrix< Entry, Index >::conjugation(), Kaskade::createCuboid(), Kaskade::createGrid(), Kaskade::deformedProlongationStack(), Kaskade::MGProlongation::galerkinProjection(), Kaskade::GridManagerBase< Grd >::globalRefine(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeBlockJacobiPMultiGrid(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeJacobiMultiGrid(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeMultiplicativePMultiGrid(), Kaskade::MultiGridStack< Prolongation, Entry, Index >::MultiGridStack(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::MultiplicativeMultiGrid(), Kaskade::nonNestedProlognationStack(), Kaskade::PatchDomainDecompositionPreconditioner< Space, m, StorageTag, SparseMatrixIndex >::PatchDomainDecompositionPreconditioner(), Kaskade::prolongation(), Kaskade::prolongationStack(), Kaskade::sdcIterationStep2(), Kaskade::BDDC::KKTSolver< Domain >::solve(), Kaskade::BoundaryLocator< GridView, Function, dimw >::updateDisplacement(), and Kaskade::writeVTK().
std::ostream & Kaskade::Timings::report | ( | std::ostream & | out, |
int | maxlevel = 1000 |
||
) | const |
Prints a timing report to the given stream.
maxlevel | report only timings up to a nesting level given here |
struct Times const * Kaskade::Timings::start | ( | std::string const & | name | ) |
Starts or continues the timing of given section.
If the section has not been started before, it is created.
Example:
Referenced by Kaskade::GridManagerBase< Grd >::adapt(), Kaskade::NumaBCRSMatrix< Entry, Index >::conjugation(), Kaskade::createCuboid(), Kaskade::createGrid(), Kaskade::deformedProlongationStack(), Kaskade::MGProlongation::galerkinProjection(), Kaskade::GridManagerBase< Grd >::globalRefine(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeBlockJacobiPMultiGrid(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeJacobiMultiGrid(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeMultiplicativePMultiGrid(), Kaskade::BDDC::matrixDomainDecommposition(), Kaskade::MultiGridStack< Prolongation, Entry, Index >::MultiGridStack(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::MultiplicativeMultiGrid(), Kaskade::PatchDomainDecompositionPreconditioner< Space, m, StorageTag, SparseMatrixIndex >::PatchDomainDecompositionPreconditioner(), Kaskade::prolongation(), Kaskade::prolongationStack(), Kaskade::BDDC::KKTSolver< Domain >::solve(), and Kaskade::uniformEmbeddedErrorEstimation().
Timings_Details::SectionBeacon Kaskade::Timings::startSection | ( | std::string const & | name | ) |
Provides a beacon to handing over to ScopedTimingSection for starting a section.
The advantage over calling start/stop manually is that ScopedTimingSection is exception and return safe. The following example works, while a start/stop approach would lead to a corrupted timing state and cause errors if the return statement is executed.
void Kaskade::Timings::stop | ( | std::string const & | name | ) |
Stops the timing of given section.
name | if the running section's name does not coincide with the given one, a LookupException is thrown |
Referenced by Kaskade::GridManagerBase< Grd >::adapt(), Kaskade::NumaBCRSMatrix< Entry, Index >::conjugation(), Kaskade::createCuboid(), Kaskade::createGrid(), Kaskade::deformedProlongationStack(), Kaskade::MGProlongation::galerkinProjection(), Kaskade::GridManagerBase< Grd >::globalRefine(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeBlockJacobiPMultiGrid(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeJacobiMultiGrid(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::makeMultiplicativePMultiGrid(), Kaskade::MultiGridStack< Prolongation, Entry, Index >::MultiGridStack(), Kaskade::MultiplicativeMultiGrid< Entry, Index, Smoother, Prolongation >::MultiplicativeMultiGrid(), Kaskade::prolongation(), Kaskade::prolongationStack(), Kaskade::BDDC::KKTSolver< Domain >::solve(), and Kaskade::uniformEmbeddedErrorEstimation().
void Kaskade::Timings::stop | ( | struct Times const * | ticket = nullptr | ) |
Stops the timing of given section.
ticket | if the running section's ticket does not coincide with the given one, a LookupException is thrown. If no ticket is provided, no checking takes place (which can save a few CPU cycles, in case that's relevant). |
|
related |
write a timing report to a stream