All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
aggregateTreeBuilder.h
1 //
2 // Copyright 2018 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 
25 #ifndef TRACE_AGGREGATE_TREE_BUILDER_H
26 #define TRACE_AGGREGATE_TREE_BUILDER_H
27 
28 #include "pxr/pxr.h"
29 
30 #include "pxr/base/trace/api.h"
31 #include "pxr/base/trace/collection.h"
32 #include "pxr/base/trace/aggregateTree.h"
33 #include "pxr/base/trace/eventTree.h"
34 
35 PXR_NAMESPACE_OPEN_SCOPE
36 
45 {
46 public:
47  static void AddEventTreeToAggregate(
48  TraceAggregateTree* aggregateTree,
49  const TraceEventTreeRefPtr& eventTree,
50  const TraceCollection& collection);
51 
52 private:
54  TraceAggregateTree* tree, const TraceEventTreeRefPtr& eventTree);
55 
56  void _ProcessCounters(const TraceCollection& collection);
57 
58  void _CreateAggregateNodes();
59 
60  // TraceCollection::Visitor interface
61  virtual void OnBeginCollection() override;
62  virtual void OnEndCollection() override;
63  virtual void OnBeginThread(const TraceThreadId& threadId) override;
64  virtual void OnEndThread(const TraceThreadId& threadId) override;
65  virtual bool AcceptsCategory(TraceCategoryId categoryId) override;
66  virtual void OnEvent(
67  const TraceThreadId& threadIndex,
68  const TfToken& key,
69  const TraceEvent& e) override;
70 
71  void _OnCounterEvent(const TraceThreadId& threadIndex,
72  const TfToken& key,
73  const TraceEvent& e);
74 
75  TraceAggregateNodePtr _FindAggregateNode(
76  const TraceThreadId& threadId, const TraceEvent::TimeStamp ts) const ;
77 
78  TraceAggregateTree* _aggregateTree;
79  TraceEventTreeRefPtr _tree;
80 };
81 
82 PXR_NAMESPACE_CLOSE_SCOPE
83 
84 #endif // TRACE_AGGREGATE_TREE_BUILDER_H
A representation of a call tree.
Definition: aggregateTree.h:48
uint64_t TimeStamp
Time in "ticks".
Definition: event.h:50
This class populates a tree of TraceAggregateTree instances from TraceCollection instances.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
This represents an event recorded by a TraceCollector.
Definition: event.h:47
This interface provides a way to access data a TraceCollection.
Definition: collection.h:83
This class owns lists of TraceEvent instances per thread, and allows read access to them...
Definition: collection.h:49
uint32_t TraceCategoryId
Categories that a TraceReporter can use to filter events.
Definition: category.h:44