![]() |
|
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. More...
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 > |
![]() | |
using | This = TraceReporterBase |
using | ThisPtr = TraceReporterBasePtr |
using | ThisRefPtr = TraceReporterBaseRefPtr |
using | CollectionPtr = std::shared_ptr< TraceCollection > |
using | DataSourcePtr = std::unique_ptr< TraceReporterDataSourceBase > |
![]() | |
typedef void(* | UniqueChangedFuncPtr) (TfRefBase const *, bool) |
Public Member Functions | |
TF_MALLOC_TAG_NEW ("Trace", "TraceReporter") | |
virtual TRACE_API | ~TraceReporter () |
Destructor. More... | |
const std::string & | GetLabel () |
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 () |
This fully re-builds the event and aggregate trees from whatever the current collection holds. More... | |
TRACE_API void | ClearTree () |
Clears event tree and counters. More... | |
Report Generation. | |
TRACE_API void | Report (std::ostream &s, int iterationCount=1) |
Generates a report to the ostream s, dividing all times by iterationCount. More... | |
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) |
Generates a timeline trace report suitable for viewing in Chrome's trace viewer. More... | |
Counters | |
TRACE_API const CounterMap & | GetCounters () const |
Returns a map of counters (counter keys), associated with their total accumulated value. More... | |
TRACE_API int | GetCounterIndex (const TfToken &key) const |
Returns the numeric index associated with a counter key. More... | |
TRACE_API bool | AddCounter (const TfToken &key, int index, double totalValue) |
Add a counter to the reporter. More... | |
Report options. | |
TRACE_API void | SetGroupByFunction (bool) |
This affects only stack trace event reporting. More... | |
TRACE_API bool | GetGroupByFunction () const |
Returns the current group-by-function state. More... | |
TRACE_API void | SetFoldRecursiveCalls (bool) |
When stack trace event reporting, this sets whether or not recursive calls are folded in the output. More... | |
TRACE_API bool | GetFoldRecursiveCalls () const |
Returns the current setting for recursion folding for stack trace event reporting. More... | |
TRACE_API void | SetShouldAdjustForOverheadAndNoise (bool adjust) |
Set whether or not the reporter should adjust scope times for overhead and noise. More... | |
TRACE_API bool | ShouldAdjustForOverheadAndNoise () const |
Returns the current setting for addjusting scope times for overhead and noise. More... | |
![]() | |
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... | |
![]() | |
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 TfRefCount & | GetRefCount () const |
void | SetShouldInvokeUniqueChangedListener (bool shouldCall) |
![]() | |
TfWeakBase (const TfWeakBase &) | |
const TfWeakBase & | __GetTfWeakBase__ () const |
const TfWeakBase & | operator= (const TfWeakBase &) |
void | EnableNotification2 () const |
TF_API void const * | GetUniqueIdentifier () 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 TraceAggregateNode::Id | CreateValidEventId () |
Creates a valid TraceAggregateNode::Id object. More... | |
![]() | |
static TF_API void | SetUniqueChangedListener (UniqueChangedListener listener) |
Protected Member Functions | |
TRACE_API | TraceReporter (const std::string &label, DataSourcePtr dataSource) |
![]() | |
TRACE_API void | _Clear () |
Removes all references to TraceCollections. More... | |
TRACE_API void | _Update () |
Gets the latest data from the TraceCollector singleton and processes all collections that have been received since the last call to _Update(). More... | |
![]() | |
TfRefPtr< Tf_Remnant > | _Register () const |
template<class T > | |
TfRefPtr< Tf_Remnant > | _Register (T *tempRmnt) const |
bool | _HasRemnant () const |
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.
|
virtual |
Destructor.
TRACE_API bool 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 ClearTree | ( | ) |
Clears event tree and counters.
|
static |
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 GetAggregateTreeRoot | ( | ) |
Returns the root node of the aggregated call tree.
TRACE_API int 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& 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 GetEventRoot | ( | ) |
Returns the root node of the call tree.
TRACE_API TraceEventTreeRefPtr GetEventTree | ( | ) |
Returns the event call tree.
TRACE_API bool GetFoldRecursiveCalls | ( | ) | const |
Returns the current setting for recursion folding for stack trace event reporting.
|
static |
Returns the global reporter.
TRACE_API bool GetGroupByFunction | ( | ) | const |
Returns the current group-by-function state.
|
inline |
Return the label associated with this reporter.
Definition at line 96 of file reporter.h.
|
inlinestatic |
Create a new reporter with label and dataSource.
Definition at line 79 of file reporter.h.
|
inlinestatic |
Create a new reporter with label and no data source.
Definition at line 85 of file reporter.h.
TRACE_API void Report | ( | std::ostream & | s, |
int | iterationCount = 1 |
||
) |
Generates a report to the ostream s, dividing all times by iterationCount.
TRACE_API void ReportChromeTracing | ( | std::ostream & | s | ) |
Generates a timeline trace report suitable for viewing in Chrome's trace viewer.
TRACE_API void ReportTimes | ( | std::ostream & | s | ) |
Generates a report of the times to the ostream s.
TRACE_API void 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 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.
TRACE_API void SetShouldAdjustForOverheadAndNoise | ( | bool | adjust | ) |
Set whether or not the reporter should adjust scope times for overhead and noise.
TRACE_API bool ShouldAdjustForOverheadAndNoise | ( | ) | const |
Returns the current setting for addjusting scope times for overhead and noise.
TRACE_API void 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.