#include <rutz/trace.h>
Public Member Functions | |
trace (rutz::prof &p, bool use_msg) throw () | |
Construct a rutz::trace object. | |
~trace () throw () | |
Destruct the rutz::trace object, accumulating time information in the stored rutz::prof. | |
Static Public Member Functions | |
static bool | get_global_trace () throw () |
Query whether we are unconditionally printing trace in/out messages. | |
static void | set_global_trace (bool on_off) throw () |
Set whether to unconditionally print trace in/out messages. | |
static unsigned int | get_max_level () throw () |
Get the max nesting level for printing trace in/out messages. | |
static void | set_max_level (unsigned int lev) throw () |
Set the max nesting level for printing trace in/out messages. |
This class cooperates with rutz::prof. rutz::prof objects are expected to have "long" lifetimes, and accumulate timing information over multiple passes. In each pass, a rutz::trace object should be constructed, which will pass its runtime info onto the rutz::prof, which then accumulates the timing info.
Definition at line 76 of file trace.h.
rutz::trace::trace | ( | rutz::prof & | p, | |
bool | use_msg | |||
) | throw () |
Construct a rutz::trace object.
Store the current time internally (either the wall clock time or current user+sys rusage, depending on the current timing_mode). If use_msg, then print a trace-begin message to stderr showing the name of the given rutz::prof.
Definition at line 123 of file trace.cc.
References rutz::prof::context_name(), and rutz::prof::get_now_time().
rutz::trace::~trace | ( | ) | throw () |
Destruct the rutz::trace object, accumulating time information in the stored rutz::prof.
Get the new time (either wall clock or user+sys rusage, matching whatever we did in the rutz::trace constructor. If we printed a trace-begin message, then also print a matching trace-end message.
Definition at line 140 of file trace.cc.
References rutz::prof::add_child_time(), rutz::prof::add_time(), rutz::prof::context_name(), rutz::backtrace::current(), rutz::prof::get_now_time(), rutz::backtrace::pop(), and rutz::backtrace::top().