All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TraceReporter Class Reference

#include <reporter.h>

+ Inheritance diagram for TraceReporter:

Public Types

using This = TraceReporter
using ThisPtr = TraceReporterPtr
using ThisRefPtr = TraceReporterRefPtr
using Event = TraceEvent
using TimeStamp = TraceEvent::TimeStamp
using CounterMap = TfHashMap< TfToken, double, TfToken::HashFunctor >
- Public Types inherited from TraceReporterBase
using This = TraceReporterBase
using ThisPtr = TraceReporterBasePtr
using ThisRefPtr = TraceReporterBaseRefPtr
using CollectionPtr = std::shared_ptr< TraceCollection >
using DataSourcePtr = std::unique_ptr< TraceReporterDataSourceBase >
- Public Types inherited from TfRefBase
typedef void(* UniqueChangedFuncPtr )(TfRefBase const *, bool)

Public Member Functions

 TF_MALLOC_TAG_NEW ("Trace","TraceReporter")
virtual TRACE_API ~TraceReporter ()
 Destructor. More...
const std::stringGetLabel ()
 Return the label associated with this reporter. More...
TRACE_API TraceAggregateNodePtr GetAggregateTreeRoot ()
 Returns the root node of the aggregated call tree. More...
TRACE_API TraceEventNodeRefPtr GetEventRoot ()
 Returns the root node of the call tree. More...
TRACE_API TraceEventTreeRefPtr GetEventTree ()
 Returns the event call tree. More...
TRACE_API void UpdateTraceTrees ()
TRACE_API void ClearTree ()
 Clears event tree and counters. More...
Report Generation.
TRACE_API void Report (std::ostream &s, int iterationCount=1)
TRACE_API void ReportTimes (std::ostream &s)
 Generates a report of the times to the ostream s. More...
TRACE_API void ReportChromeTracing (std::ostream &s)
TRACE_API const CounterMapGetCounters () const
TRACE_API int GetCounterIndex (const TfToken &key) const
TRACE_API bool AddCounter (const TfToken &key, int index, double totalValue)
Report options.
TRACE_API void SetGroupByFunction (bool)
TRACE_API bool GetGroupByFunction () const
 Returns the current group-by-function state. More...
TRACE_API void SetFoldRecursiveCalls (bool)
TRACE_API bool GetFoldRecursiveCalls () const
- Public Member Functions inherited from TraceReporterBase
TRACE_API TraceReporterBase (DataSourcePtr dataSource)
 Constructor taking ownership of dataSource. More...
virtual TRACE_API ~TraceReporterBase ()
 Destructor. More...
TRACE_API bool SerializeProcessedCollections (std::ostream &ostr) const
 Write all collections that were processed by this reporter to ostr. More...
- Public Member Functions inherited from TfRefBase
 TfRefBase ()
size_t GetCurrentCount () const
 Return the current reference count of this object. More...
bool IsUnique () const
 Return true if only one TfRefPtr points to this object. More...
const TfRefCountGetRefCount () const
void SetShouldInvokeUniqueChangedListener (bool shouldCall)
- Public Member Functions inherited from TfWeakBase
 TfWeakBase ()
 TfWeakBase (const TfWeakBase &)
const TfWeakBase__GetTfWeakBase__ () const
const TfWeakBaseoperator= (const TfWeakBase &)
void EnableNotification2 () const
TF_API void constGetUniqueIdentifier () const

Static Public Member Functions

static ThisRefPtr New (const std::string &label, DataSourcePtr dataSource)
 Create a new reporter with label and dataSource. More...
static ThisRefPtr New (const std::string &label)
 Create a new reporter with label and no data source. More...
static TRACE_API TraceReporterPtr GetGlobalReporter ()
 Returns the global reporter. More...
static TRACE_API
CreateValidEventId ()
- Static Public Member Functions inherited from TfRefBase
static TF_API void SetUniqueChangedListener (UniqueChangedListener listener)

Protected Member Functions

TRACE_API TraceReporter (const std::string &label, DataSourcePtr dataSource)
- Protected Member Functions inherited from TraceReporterBase
TRACE_API void _Clear ()
 Removes all references to TraceCollections. More...
TRACE_API void _Update ()
- Protected Member Functions inherited from TfRefBase
virtual TF_API ~TfRefBase ()
- Protected Member Functions inherited from TfWeakBase
 ~TfWeakBase ()
TfRefPtr< Tf_Remnant_Register () const
template<class T >
TfRefPtr< Tf_Remnant_Register (T *tempRmnt) const
bool _HasRemnant () const

Detailed Description

This class converts streams of TraceEvent objects into call trees which can then be used as a data source to a GUI or written out to a file.

Definition at line 64 of file reporter.h.

Member Typedef Documentation

Definition at line 76 of file reporter.h.

Definition at line 74 of file reporter.h.

Definition at line 70 of file reporter.h.

using TraceReporter::ThisPtr = TraceReporterPtr

Definition at line 71 of file reporter.h.

using TraceReporter::ThisRefPtr = TraceReporterRefPtr

Definition at line 72 of file reporter.h.

Definition at line 75 of file reporter.h.

Constructor & Destructor Documentation

virtual TRACE_API TraceReporter::~TraceReporter ( )


TRACE_API TraceReporter::TraceReporter ( const std::string label,
DataSourcePtr  dataSource 

Member Function Documentation

TRACE_API bool TraceReporter::AddCounter ( const TfToken key,
int  index,
double  totalValue 

Add a counter to the reporter. This method can be used to restore a previous trace state and tree. Note, that the counter being added must have a unique key and index. The method will return false if a key or index already exists.

TRACE_API void TraceReporter::ClearTree ( )

Clears event tree and counters.

static TRACE_API TraceAggregateNode::Id TraceReporter::CreateValidEventId ( )

Creates a valid TraceAggregateNode::Id object. This should be used by very few clients for certain special cases. For most cases, the TraceAggregateNode::Id object should be created and populated internally within the Reporter object itself.

TRACE_API TraceAggregateNodePtr TraceReporter::GetAggregateTreeRoot ( )

Returns the root node of the aggregated call tree.

TRACE_API int TraceReporter::GetCounterIndex ( const TfToken key) const

Returns the numeric index associated with a counter key. Counter values on the event nodes will have to be looked up by the numeric index.

TRACE_API const CounterMap& TraceReporter::GetCounters ( ) const

Returns a map of counters (counter keys), associated with their total accumulated value. Each individual event node in the tree may also hold on to an inclusive and exclusive value for the given counter.

TRACE_API TraceEventNodeRefPtr TraceReporter::GetEventRoot ( )

Returns the root node of the call tree.

TRACE_API TraceEventTreeRefPtr TraceReporter::GetEventTree ( )

Returns the event call tree.

TRACE_API bool TraceReporter::GetFoldRecursiveCalls ( ) const

Returns the current setting for recursion folding for stack trace event reporting.

static TRACE_API TraceReporterPtr TraceReporter::GetGlobalReporter ( )

Returns the global reporter.

TRACE_API bool TraceReporter::GetGroupByFunction ( ) const

Returns the current group-by-function state.

const std::string& TraceReporter::GetLabel ( )

Return the label associated with this reporter.

Definition at line 96 of file reporter.h.

static ThisRefPtr TraceReporter::New ( const std::string label,
DataSourcePtr  dataSource 

Create a new reporter with label and dataSource.

Definition at line 79 of file reporter.h.

static ThisRefPtr TraceReporter::New ( const std::string label)

Create a new reporter with label and no data source.

Definition at line 85 of file reporter.h.

TRACE_API void TraceReporter::Report ( std::ostream &  s,
int  iterationCount = 1 

Generates a report to the ostream s, dividing all times by iterationCount.

TRACE_API void TraceReporter::ReportChromeTracing ( std::ostream &  s)

Generates a timeline trace report suitable for viewing in Chrome's trace viewer.

TRACE_API void TraceReporter::ReportTimes ( std::ostream &  s)

Generates a report of the times to the ostream s.

TRACE_API void TraceReporter::SetFoldRecursiveCalls ( bool  )

When stack trace event reporting, this sets whether or not recursive calls are folded in the output. Recursion folding is useful when the stacks contain deep recursive structures.

TRACE_API void TraceReporter::SetGroupByFunction ( bool  )

This affects only stack trace event reporting. If true then all events in a function are grouped together otherwise events are split out by address.

TraceReporter::TF_MALLOC_TAG_NEW ( "Trace"  ,
TRACE_API void TraceReporter::UpdateTraceTrees ( )

This fully re-builds the event and aggregate trees from whatever the current collection holds. It is ok to call this multiple times in case the collection gets appended on inbetween.

If we want to have multiple reporters per collector, this will need to be changed so that all reporters reporting on a collector update their respective trees.

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