25 #ifndef PXR_BASE_TRACE_REPORTER_H 26 #define PXR_BASE_TRACE_REPORTER_H 30 #include "pxr/base/trace/api.h" 31 #include "pxr/base/trace/event.h" 32 #include "pxr/base/trace/aggregateNode.h" 33 #include "pxr/base/trace/reporterBase.h" 42 PXR_NAMESPACE_OPEN_SCOPE
44 #define TRACE_REPORTER_TOKENS \ 45 ((warningString, "WARNING:")) 68 TF_MALLOC_TAG_NEW(
"Trace",
"TraceReporter");
71 using ThisPtr = TraceReporterPtr;
72 using ThisRefPtr = TraceReporterRefPtr;
76 using CounterMap = TfHashMap<TfToken, double, TfToken::HashFunctor>;
79 static ThisRefPtr
New(
const std::string& label,
80 DataSourcePtr dataSource) {
81 return TfCreateRefPtr(
new This(label, std::move(dataSource)));
85 static ThisRefPtr
New(
const std::string& label) {
86 return TfCreateRefPtr(
new This(label,
nullptr));
107 int iterationCount=1);
198 DataSourcePtr dataSource);
201 void _ProcessCollection(
const TraceReporterBase::CollectionPtr&)
override;
202 void _RebuildEventAndAggregateTrees();
203 void _PrintTimes(std::ostream &s);
208 bool _groupByFunction;
209 bool _foldRecursiveCalls;
210 bool _shouldAdjustForOverheadAndNoise;
212 TraceAggregateTreeRefPtr _aggregateTree;
213 TraceEventTreeRefPtr _eventTree;
216 PXR_NAMESPACE_CLOSE_SCOPE
218 #endif // PXR_BASE_TRACE_REPORTER_H static TRACE_API TraceAggregateNode::Id CreateValidEventId()
Creates a valid TraceAggregateNode::Id object.
TRACE_API void ClearTree()
Clears event tree and counters.
TRACE_API void SetFoldRecursiveCalls(bool)
When stack trace event reporting, this sets whether or not recursive calls are folded in the output.
static ThisRefPtr New(const std::string &label, DataSourcePtr dataSource)
Create a new reporter with label and dataSource.
TRACE_API int GetCounterIndex(const TfToken &key) const
Returns the numeric index associated with a counter key.
TRACE_API TraceEventNodeRefPtr GetEventRoot()
Returns the root node of the call tree.
Standard pointer typedefs.
TRACE_API void ReportTimes(std::ostream &s)
Generates a report of the times to the ostream s.
A representation of a call tree.
This class contains a timeline call tree and a map of counters to their values over time.
TRACE_API void SetGroupByFunction(bool)
This affects only stack trace event reporting.
TraceEventNode is used to represents call tree of a trace.
const std::string & GetLabel()
Return the label associated with this reporter.
uint64_t TimeStamp
Time in "ticks".
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
TRACE_API void UpdateTraceTrees()
This fully re-builds the event and aggregate trees from whatever the current collection holds.
TRACE_API bool GetFoldRecursiveCalls() const
Returns the current setting for recursion folding for stack trace event reporting.
This class is a base class for report implementations.
TRACE_API bool ShouldAdjustForOverheadAndNoise() const
Returns the current setting for addjusting scope times for overhead and noise.
TRACE_API bool AddCounter(const TfToken &key, int index, double totalValue)
Add a counter to the reporter.
Token for efficient comparison, assignment, and hashing of known strings.
This represents an event recorded by a TraceCollector.
static ThisRefPtr New(const std::string &label)
Create a new reporter with label and no data source.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
static TRACE_API TraceReporterPtr GetGlobalReporter()
Returns the global reporter.
virtual TRACE_API ~TraceReporter()
Destructor.
A TfNotice that is sent when the TraceCollector creates a TraceCollection.
TRACE_API void SetShouldAdjustForOverheadAndNoise(bool adjust)
Set whether or not the reporter should adjust scope times for overhead and noise.
TRACE_API void ReportChromeTracing(std::ostream &s)
Generates a timeline trace report suitable for viewing in Chrome's trace viewer.
TRACE_API TraceEventTreeRefPtr GetEventTree()
Returns the event call tree.
TRACE_API void Report(std::ostream &s, int iterationCount=1)
Generates a report to the ostream s, dividing all times by iterationCount.
This file defines some macros that are useful for declaring and using static TfTokens.
TRACE_API TraceAggregateNodePtr GetAggregateTreeRoot()
Returns the root node of the aggregated call tree.
This class converts streams of TraceEvent objects into call trees which can then be used as a data so...
TRACE_API const CounterMap & GetCounters() const
Returns a map of counters (counter keys), associated with their total accumulated value.
TRACE_API bool GetGroupByFunction() const
Returns the current group-by-function state.