rutz::trace Class Reference

Times and traces execution in and out of a lexical scope. More...

#include <rutz/trace.h>

Collaboration diagram for rutz::trace:

Collaboration graph
[legend]

List of all members.

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.


Detailed Description

Times and traces execution in and out of a lexical scope.

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.


Constructor & Destructor Documentation

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().


The documentation for this class was generated from the following files:

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:56:46 2008 by Doxygen version 1.5.5.