#include <TraceSource.h>
Inheritance diagram for TraceSource:
Public Member Functions | |
virtual | ~TraceSource () |
virtual void | initTraceSource (SharedTraceTarget pTraceTarget, std::string name) |
For use when initialization has to be deferred until after construction. | |
void | trace (TraceLevel level, std::string message) const |
Records a trace message. | |
bool | isTracing () const |
| |
bool | isTracingLevel (TraceLevel level) const |
Determines whether a particular level is being traced. | |
TraceTarget & | getTraceTarget () const |
| |
SharedTraceTarget | getSharedTraceTarget () const |
| |
std::string | getTraceSourceName () const |
Gets the name of this source. | |
void | setTraceSourceName (std::string const &n) |
Sets the name of this source. | |
TraceLevel | getMinimumTraceLevel () const |
void | disableTracing () |
Protected Member Functions | |
TraceSource () | |
Constructs a new uninitialized TraceSource. | |
TraceSource (SharedTraceTarget pTraceTarget, std::string name) | |
Constructs a new TraceSource. | |
Private Attributes | |
SharedTraceTarget | pTraceTarget |
std::string | name |
TraceLevel | minimumLevel |
Definition at line 36 of file TraceSource.h.
TraceSource::TraceSource | ( | ) | [explicit, protected] |
Constructs a new uninitialized TraceSource.
Definition at line 30 of file TraceSource.cpp.
References minimumLevel, and TRACE_OFF.
00031 { 00032 minimumLevel = TRACE_OFF; 00033 }
TraceSource::TraceSource | ( | SharedTraceTarget | pTraceTarget, | |
std::string | name | |||
) | [explicit, protected] |
Constructs a new TraceSource.
pTraceTarget | the TraceTarget to which messages will be sent, or NULL to disable tracing entirely | |
name | the name of this source (can be empty string for deferred init) |
Definition at line 35 of file TraceSource.cpp.
References initTraceSource().
00038 { 00039 initTraceSource(pTraceTargetInit,nameInit); 00040 }
TraceSource::~TraceSource | ( | ) | [virtual] |
void TraceSource::initTraceSource | ( | SharedTraceTarget | pTraceTarget, | |
std::string | name | |||
) | [virtual] |
For use when initialization has to be deferred until after construction.
pTraceTarget | the TraceTarget to which messages will be sent | |
name | the name of this source |
Definition at line 46 of file TraceSource.cpp.
References isTracing(), minimumLevel, name, pTraceTarget, and TRACE_OFF.
Referenced by TestBase::beforeTestCase(), TestBase::TestBase(), and TraceSource().
00049 { 00050 assert(!pTraceTarget.get()); 00051 00052 pTraceTarget = pTraceTargetInit; 00053 name = nameInit; 00054 if (isTracing()) { 00055 minimumLevel = pTraceTarget->getSourceTraceLevel(name); 00056 } else { 00057 minimumLevel = TRACE_OFF; 00058 } 00059 }
void TraceSource::trace | ( | TraceLevel | level, | |
std::string | message | |||
) | const |
Records a trace message.
Normally only called via FENNEL_TRACE.
level | severity level of event being trace | |
message | the text of the message |
Definition at line 61 of file TraceSource.cpp.
References getTraceTarget(), isTracing(), name, and TraceTarget::notifyTrace().
Referenced by Calculator::exec(), and ExecStreamScheduler::traceStreamBufferContents().
00062 { 00063 if (isTracing()) { 00064 getTraceTarget().notifyTrace(name,level,message); 00065 } 00066 }
bool TraceSource::isTracing | ( | ) | const [inline] |
Definition at line 88 of file TraceSource.h.
Referenced by initTraceSource(), CalcExecStream::prepare(), and trace().
00089 { 00090 return pTraceTarget.get() ? true : false; 00091 }
bool TraceSource::isTracingLevel | ( | TraceLevel | level | ) | const [inline] |
Determines whether a particular level is being traced.
level | trace level to test |
Definition at line 100 of file TraceSource.h.
Referenced by ExecStreamScheduler::addGraph(), SimpleExecStreamGovernor::assignCachePages(), SimpleExecStreamGovernor::distributeCachePages(), Calculator::exec(), ExecStreamScheduler::ExecStreamScheduler(), LcsClusterNodeWriter::getLastClusterPageForWrite(), LcsClusterNodeWriter::moveFromTempToIndex(), JavaSinkExecStream::stuffByteBuffer(), and ExecStreamScheduler::traceStreamBuffers().
00101 { 00102 return level >= minimumLevel; 00103 }
TraceTarget& TraceSource::getTraceTarget | ( | ) | const [inline] |
Definition at line 108 of file TraceSource.h.
Referenced by trace().
00109 { 00110 assert(isTracing()); 00111 return *(pTraceTarget.get()); 00112 }
SharedTraceTarget TraceSource::getSharedTraceTarget | ( | ) | const [inline] |
Definition at line 117 of file TraceSource.h.
Referenced by Database::init(), LcsClusterAppendExecStream::initLoad(), and CalcExecStream::prepare().
00118 { 00119 return pTraceTarget; 00120 }
std::string TraceSource::getTraceSourceName | ( | ) | const [inline] |
Gets the name of this source.
Useful to construct nested names for subcomponents that are also TraceSources.
Definition at line 127 of file TraceSource.h.
Referenced by LcsClusterAppendExecStream::initLoad().
00128 { 00129 return name; 00130 }
void TraceSource::setTraceSourceName | ( | std::string const & | n | ) | [inline] |
Sets the name of this source.
Useful to construct dynamic names for fine-grained filtering.
Definition at line 136 of file TraceSource.h.
00137 { 00138 name = n; 00139 }
TraceLevel TraceSource::getMinimumTraceLevel | ( | ) | const [inline] |
void TraceSource::disableTracing | ( | ) |
Definition at line 68 of file TraceSource.cpp.
References minimumLevel, pTraceTarget, and TRACE_OFF.
Referenced by TestBase::afterTestCase().
00069 { 00070 pTraceTarget.reset(); 00071 minimumLevel = TRACE_OFF; 00072 }
SharedTraceTarget TraceSource::pTraceTarget [private] |
std::string TraceSource::name [private] |
Reimplemented in ExecStream.
Definition at line 40 of file TraceSource.h.
Referenced by initTraceSource(), ExecStreamGraphEmbryo::prepareGraph(), ConfigMap::readParams(), and trace().
TraceLevel TraceSource::minimumLevel [private] |
Definition at line 42 of file TraceSource.h.
Referenced by disableTracing(), initTraceSource(), and TraceSource().