LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
|
#include <BlockTimingLog.h>
Public Types | |
enum | usageData { NOUDATA = 0, UTIME = 1, STIME = 2, SUTIME = 3, MEMSZ = 4, NSWAP = 16, BLKIN = 32, BLKOUT = 64, BLKIO = 96, MINFLT = 128, MAJFLT = 256, LINUXUDATA = 387, ALLUDATA = 511, PARENTUDATA = 8192 } |
Public Member Functions | |
BlockTimingLog (const Log &parent, const std::string &name, int tracelev=BlockTimingLog::INSTRUM, int usageFlags=PARENTUDATA, const std::string &funcName="") | |
BlockTimingLog (const BlockTimingLog &that) | |
BlockTimingLog & | operator= (const BlockTimingLog &that) |
int | getUsageFlags () const |
void | setUsageFlags (int flags) |
void | addUsageFlags (int flags) |
BlockTimingLog * | createForBlock (const std::string &name, int tracelev=Log::INHERIT_THRESHOLD, const std::string &funcName="") |
BlockTimingLog * | timeBlock (const std::string &name, int tracelev=Log::INHERIT_THRESHOLD, const std::string &funcName="") |
virtual | ~BlockTimingLog () |
void | start () |
void | start (const std::string &funcName) |
void | done () |
int | getInstrumentationLevel () const |
const std::string & | getFunctionName () const |
void | addUsageProps (LogRecord &rec) |
Public Member Functions inherited from lsst::pex::logging::Log | |
Log (const int threshold=INFO, const std::string &name="") | |
Log (const std::list< boost::shared_ptr< LogDestination > > &destinations, const lsst::daf::base::PropertySet &preamble, const std::string &name="", const int threshold=INFO, bool defaultShowAll=false) | |
Log (const Log &parent, const std::string &childName, int threshold=INHERIT_THRESHOLD) | |
Log (const Log &that) | |
virtual | ~Log () |
Log & | operator= (const Log &that) |
const std::string & | getName () const |
int | getThreshold () const |
void | setThreshold (int threshold) |
bool | sends (int importance) const |
void | resetThreshold () |
void | setThresholdFor (const std::string &name, int threshold) |
int | getThresholdFor (const std::string &name) const |
bool | willShowAll () const |
void | setShowAll (bool yesno) |
void | resetShowAll () |
template<class T > | |
void | addPreambleProperty (const std::string &name, const T &val) |
template<class T > | |
void | setPreambleProperty (const std::string &name, const T &val) |
Log * | createChildLog (const std::string &childName, int threshold=INHERIT_THRESHOLD) const |
void | log (int importance, const std::string &message, const lsst::daf::base::PropertySet &properties) |
template<class T > | |
void | log (int importance, const std::string &message, const std::string &name, const T &val) |
template<class T > | |
void | log (int importance, const std::string &message, const RecordProperty< T > &prop) |
void | log (int importance, const std::string &message) |
void | log (int importance, const boost::format &message) |
void | logdebug (const std::string &message, const lsst::daf::base::PropertySet &properties) |
template<class T > | |
void | logdebug (const std::string &message, const std::string &name, const T &val) |
template<class T > | |
void | logdebug (const std::string &message, const RecordProperty< T > &prop) |
void | logdebug (const std::string &message) |
void | logdebug (const boost::format &message) |
void | info (const std::string &message, const lsst::daf::base::PropertySet &properties) |
template<class T > | |
void | info (const std::string &message, const std::string &name, const T &val) |
template<class T > | |
void | info (const std::string &message, const RecordProperty< T > &prop) |
void | info (const std::string &message) |
void | info (const boost::format &message) |
void | warn (const std::string &message, const lsst::daf::base::PropertySet &properties) |
template<class T > | |
void | warn (const std::string &message, const std::string &name, const T &val) |
template<class T > | |
void | warn (const std::string &message, const RecordProperty< T > &prop) |
void | warn (const std::string &message) |
void | warn (const boost::format &message) |
void | fatal (const std::string &message, const lsst::daf::base::PropertySet &properties) |
template<class T > | |
void | fatal (const std::string &message, const std::string &name, const T &val) |
template<class T > | |
void | fatal (const std::string &message, const RecordProperty< T > &prop) |
void | fatal (const std::string &message) |
void | fatal (const boost::format &message) |
void | format (int importance, const char *fmt,...) |
void | debugf (const char *fmt,...) |
void | infof (const char *fmt,...) |
void | warnf (const char *fmt,...) |
void | fatalf (const char *fmt,...) |
void | send (const LogRecord &record) |
void | addDestination (std::ostream &destination, int threshold) |
void | addDestination (std::ostream &destination, int threshold, const boost::shared_ptr< LogFormatter > &formatter) |
void | addDestination (const boost::shared_ptr< LogDestination > &destination) |
const lsst::daf::base::PropertySet & | getPreamble () |
void | markPersistent () |
void | printThresholds (std::ostream &out) |
void | reset () |
Static Public Attributes | |
static const int | INSTRUM = logging::Log::INFO - 3 |
static const std::string | STATUS |
static const std::string | START |
static const std::string | END |
Static Public Attributes inherited from lsst::pex::logging::Log | |
static const int | DEBUG |
static const int | INFO |
static const int | WARN |
static const int | INHERIT_THRESHOLD |
static const int | FATAL |
Private Attributes | |
int | _tracelev |
int | _pusageFlags |
int | _usageFlags |
std::string | _funcName |
boost::scoped_ptr< struct rusage > | _usage |
Additional Inherited Members | |
Static Public Member Functions inherited from lsst::pex::logging::Log | |
static Log & | getDefaultLog () |
static void | createDefaultLog (const std::list< boost::shared_ptr< LogDestination > > &destinations, const lsst::daf::base::PropertySet &preamble, const std::string &name="", const int threshold=INFO) |
static void | closeDefaultLog () |
Protected Member Functions inherited from lsst::pex::logging::Log | |
void | _send (int threshold, int importance, const char *fmt, va_list ap) |
void | _format (int importance, const char *fmt, va_list ap) |
Static Protected Member Functions inherited from lsst::pex::logging::Log | |
static void | setDefaultLog (Log *deflog) |
Protected Attributes inherited from lsst::pex::logging::Log | |
boost::shared_ptr < threshold::Memory > | _thresholds |
std::list< boost::shared_ptr < LogDestination > > | _destinations |
lsst::daf::base::PropertySet::Ptr | _preamble |
Static Protected Attributes inherited from lsst::pex::logging::Log | |
static Log * | defaultLog |
static const std::string | _sep |
a specialized Log that assists the harness in tracing execution flow.
The motivation for this class is to provide uniformity in the log messages that indicate the start and finish of some section of code. This makes it easier to locate these records after execution and calculate the time spent in the block of code.
This class can optionally be used to simultaneously capture usage data. In particular, it can add as properties the following system informtation: user cpu time, system cpu time, memory usage (as maximum resident size), the number of swaps, the number of block input operations, and the number of output operations. Which of these are save with the log message is controlled by a bit map.
Definition at line 59 of file BlockTimingLog.h.
an enumeration for controlling which usage data to collect
Definition at line 65 of file BlockTimingLog.h.
lsst::pex::logging::BlockTimingLog::BlockTimingLog | ( | const Log & | parent, |
const std::string & | name, | ||
int | tracelev = BlockTimingLog::INSTRUM , |
||
int | usageFlags = PARENTUDATA , |
||
const std::string & | funcName = "" |
||
) |
construct a BlockTimingLog.
parent | the parent log to inherit attributes from |
name | the name to give the log relative to its parent |
tracelev | the default level to use for the tracing messages |
funcName | the name of the block of code (e.g. function) being traced. If empty, the value given by name will be used instead. This value will be used in the log message only. |
usageFlags | a or-ed list of usageData values that indicate which usage data to capture. |
Definition at line 41 of file BlockTimingLog.cc.
|
inline |
create a copy of a BlockTimingLog
Definition at line 187 of file BlockTimingLog.h.
|
virtual |
|
inline |
add to the list of usage data that will be collected. Previously set values will be preserved.
flags | an integer of OR-ed usageData values for the specific data that should be captured. Use PARENTUDATA to include the parent log's usage data flags (what ever they were when this log was created). |
Definition at line 227 of file BlockTimingLog.h.
void lsst::pex::logging::BlockTimingLog::addUsageProps | ( | LogRecord & | rec | ) |
add usage properties to a given LogRecord according the currently set usage flags.
Definition at line 65 of file BlockTimingLog.cc.
|
inline |
create and return a new child that should be used while tracing a function. A "start" message will be logged to the new log as part of the call. Like createChildLog(), the caller is responsible for deleting this new instance when finished with it.
name | the name to give the log relative to its parent |
tracelev | the default level to use for the tracing messages. If equal to Log::INHERIT_THRESHOLD (default), it will be set to this log's tracing level. |
funcName | the name of the block of code (e.g. function) being traced. If empty, the value given by name will be used instead. This value will be used in the log message only. |
Definition at line 246 of file BlockTimingLog.h.
|
inline |
Indicate that the section of code being instrumented (e.g. a function body) is finished.
Definition at line 303 of file BlockTimingLog.h.
|
inline |
return the name of the code block being traced which will appear in the start and end messages.
Definition at line 327 of file BlockTimingLog.h.
|
inline |
return the instrumenting message level, the importance to be given to the start and end messages.
Definition at line 321 of file BlockTimingLog.h.
|
inline |
return an OR-ed list of flags indicating the usage data this object is set to collect with each message.
Definition at line 205 of file BlockTimingLog.h.
|
inline |
reset this instance to another
Definition at line 194 of file BlockTimingLog.h.
|
inline |
set the usage data that will be collected.
flags | an integer of OR-ed usageData values for the specific data that should be captured. Use NOUDATA to turn off the capturing of this data. Use PARENTUDATA to revert to the parent log's usage data flags. |
Definition at line 214 of file BlockTimingLog.h.
|
inline |
Indicate that the section of code being traced (e.g. a function body) is starting.
Definition at line 276 of file BlockTimingLog.h.
|
inline |
Indicate that the section of code being instrumented (e.g. a function body) is starting.
Definition at line 294 of file BlockTimingLog.h.
|
inline |
a synonym for createForBlock
Definition at line 260 of file BlockTimingLog.h.
|
private |
Definition at line 338 of file BlockTimingLog.h.
|
private |
Definition at line 337 of file BlockTimingLog.h.
|
private |
Definition at line 336 of file BlockTimingLog.h.
|
private |
Definition at line 339 of file BlockTimingLog.h.
|
private |
Definition at line 337 of file BlockTimingLog.h.
|
static |
the property to use to mark the start of a block of code being instrumented
Definition at line 165 of file BlockTimingLog.h.
|
static |
default message level for messages that instrument execution flow
Definition at line 147 of file BlockTimingLog.h.
|
static |
the property to use to mark the start of a block of code being instrumented
Definition at line 159 of file BlockTimingLog.h.
|
static |
the property name that will indicate what an instrumenting message is marking
Definition at line 153 of file BlockTimingLog.h.