25#ifndef PXR_BASE_TRACE_COUNTER_ACCUMULATOR_H
26#define PXR_BASE_TRACE_COUNTER_ACCUMULATOR_H
30#include "pxr/base/trace/api.h"
31#include "pxr/base/trace/collection.h"
36#include <unordered_map>
39PXR_NAMESPACE_OPEN_SCOPE
52 using CounterValues = std::vector<std::pair<TraceEvent::TimeStamp, double>>;
53 using CounterValuesMap =
54 std::unordered_map<TfToken, CounterValues, TfToken::HashFunctor>;
56 std::unordered_map<TfToken, double, TfToken::HashFunctor>;
63 return _counterValuesOverTime;
71 return _currentValues;
84 virtual void OnBeginCollection()
override;
85 virtual void OnEndCollection()
override;
92 struct _CounterValue {
97 using _CounterDeltaValues =
98 std::multimap<TraceEvent::TimeStamp, _CounterValue>;
99 using _CounterDeltaMap = std::map<TfToken, _CounterDeltaValues>;
101 _CounterDeltaMap _counterDeltas;
102 CounterValuesMap _counterValuesOverTime;
103 CounterMap _currentValues;
106PXR_NAMESPACE_CLOSE_SCOPE
uint32_t TraceCategoryId
Categories that a TraceReporter can use to filter events.
Token for efficient comparison, assignment, and hashing of known strings.
This interface provides a way to access data a TraceCollection.
This class owns lists of TraceEvent instances per thread, and allows read access to them.
This class accumulates counter values from TraceCollection instances.
TraceCounterAccumulator()=default
Constructor.
const CounterMap & GetCurrentValues() const
Returns the current value of the counters.
virtual bool _AcceptsCategory(TraceCategoryId id)=0
Determines whether or not counter events with id should be processed.
const CounterValuesMap & GetCounters() const
Returns a map of the counter values over time.
TRACE_API void SetCurrentValues(const CounterMap &)
Sets the current value of the counters.
TRACE_API void Update(const TraceCollection &collection)
Reads events /p collection and updates the current values of the counters.
This represents an event recorded by a TraceCollector.
This class represents an identifier for a thread.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...