Teuchos - Trilinos Tools Package
Version of the Day
|
This class allows one to push and pop timers on and off a stack. More...
#include <Teuchos_StackedTimer.hpp>
Classes | |
struct | AlignmentWidths |
Stores the column widths for output alignment. More... | |
class | LevelTimer |
Timer info at a given level and all the children. More... | |
struct | OutputOptions |
Struct for controlling output options like histograms. More... | |
Public Member Functions | |
StackedTimer (const char *name, const bool start_base_timer=true) | |
void | startBaseTimer () |
void | stopBaseTimer () |
void | start (const std::string name, const bool push_kokkos_profiling_region=true) |
void | stop (const std::string &name, const bool pop_kokkos_profiling_region=true) |
void | incrementUpdates (const long long i=1) |
double | accumulatedTime (const std::string &name="") |
double | accumulatedTimePerUpdate (const std::string &name="") |
double | accumulatedTimePerTimerCall (const std::string &name="") |
const BaseTimer * | findBaseTimer (const std::string &name) const |
BaseTimer::TimeInfo | findTimer (const std::string &name) |
void | report (std::ostream &os, Teuchos::RCP< const Teuchos::Comm< int > > comm, OutputOptions options=OutputOptions()) |
Protected Member Functions | |
void | flatten () |
void | merge (Teuchos::RCP< const Teuchos::Comm< int > > comm) |
void | collectRemoteData (Teuchos::RCP< const Teuchos::Comm< int > > comm, const OutputOptions &options) |
double | computeColumnWidthsForAligment (std::string prefix, int print_level, std::vector< bool > &printed, double parent_time, const OutputOptions &options) |
double | printLevel (std::string prefix, int level, std::ostream &os, std::vector< bool > &printed, double parent_time, const OutputOptions &options) |
Protected Attributes | |
LevelTimer * | top_ |
Current level running. More... | |
LevelTimer | timer_ |
Base timer. More... | |
This class allows one to push and pop timers on and off a stack.
To use this class one would do something like this
StackedTimer timer(); // construct top level timer timer.start("some comp"); do_work(); timer.start("sub comp"); more_work(); timer.stop(); // stopping sub comp timer.stop(); // stopping comp
timer.stop(); // stopping all timer stuff timer.report(std::cout); // dump to screen
Definition at line 182 of file Teuchos_StackedTimer.hpp.
|
inlineexplicit |
Construct a stacked timer
[in] | name | Top level name of the timer |
[in] | start_top_timer | Automatically start the top level timer. If set to false, the user will have to start it manually. |
Definition at line 429 of file Teuchos_StackedTimer.hpp.
|
inline |
Start the base level timer only
Definition at line 440 of file Teuchos_StackedTimer.hpp.
|
inline |
Stop the base level timer only
Definition at line 450 of file Teuchos_StackedTimer.hpp.
|
inline |
Start a sublevel timer
[in] | name | Name of the timer you wish to start |
[in] | push_kokkos_profiling_region | Optional parameter that if set to true, will pushRegion() in kokkos profiling for this timer. The TimeMonitor will always set this to false since it does its own pushRegion() in the Timer object (this prevents double registering with kokkos). |
Definition at line 462 of file Teuchos_StackedTimer.hpp.
|
inline |
Stop the current top running timer, should be called for the root timer prior to final output
[in] | name | Name of the timer you wish to stop |
[in] | pop_kokkos_profiling_region | Optional parameter that if set to true, will popRegion() in kokkos profiling for this timer. The TimeMonitor will always set this to false since it does its own pushRegion() in the Timer object (this prevents double registering with kokkos). |
Definition at line 480 of file Teuchos_StackedTimer.hpp.
|
inline |
Increment the iteration count for the running timer
[in] | i | amount to increment the count |
Definition at line 497 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the accumulated time the named timer has, if name is blank top level timer
[in] | name | Name of the timer to output |
Definition at line 506 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the time spent per update at a given level
[in] | name | name of subtimer, if blank return current level time |
Definition at line 518 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the time spent per timer start/stop at a given level
[in] | name | name of subtimer, if blank return current level time |
Definition at line 529 of file Teuchos_StackedTimer.hpp.
|
inline |
Return pointer to the BaseTimer corresponding to a given string (full string name)
name | input string to search for |
Definition at line 541 of file Teuchos_StackedTimer.hpp.
|
inline |
Return the time info for a given string (full string name)
name | input string to search for |
Definition at line 553 of file Teuchos_StackedTimer.hpp.
void Teuchos::StackedTimer::report | ( | std::ostream & | os, |
Teuchos::RCP< const Teuchos::Comm< int > > | comm, | ||
OutputOptions | options = OutputOptions() |
||
) |
Dump all the data from all the MPI ranks to an ostream
[in] | os | - Output stream |
[in] | comm | - Teuchos comm pointer |
Definition at line 500 of file Teuchos_StackedTimer.cpp.
|
protected |
Flatten the timers into a single array
Definition at line 74 of file Teuchos_StackedTimer.cpp.
|
protected |
Merge all the timers together into a single structure
[in] | comm | - Communicator to use |
Definition at line 82 of file Teuchos_StackedTimer.cpp.
|
protected |
Migrate all the timer data to rank=0 if parallel
Definition at line 89 of file Teuchos_StackedTimer.cpp.
|
protected |
Compute the column widths to align the output from report() in columns.
Definition at line 184 of file Teuchos_StackedTimer.cpp.
|
protected |
Recursive call to print a level of timer data.
Definition at line 307 of file Teuchos_StackedTimer.cpp.
|
protected |
Current level running.
Definition at line 591 of file Teuchos_StackedTimer.hpp.
|
protected |
Base timer.
Definition at line 593 of file Teuchos_StackedTimer.hpp.