Loading...
Searching...
No Matches
networkStats.h
Go to the documentation of this file.
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_EXEC_VDF_NETWORK_STATS_H
8#define PXR_EXEC_VDF_NETWORK_STATS_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/vdf/api.h"
15#include "pxr/base/tf/hash.h"
16
17#include <map>
18#include <string>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22class VdfNetwork;
23
31{
32public:
33
34 // Struct used to keep track of statistics about a node type that we
35 // care about.
36 struct NodeTypeStats {
37 int count;
38 size_t memUsage;
39 };
40
41private:
42
43 // Contains statistic information per node type.
44 typedef std::map<std::string, NodeTypeStats> _TypeStatsMap;
45 _TypeStatsMap _statsMap;
46
47public:
48
51 VDF_API
52 VdfNetworkStats(const VdfNetwork &network);
53
54
57 size_t GetMaxTypeNameLength() const { return _maxTypeNameLength; }
58
61 size_t GetMaxFanIn() const { return _maxFanIn; }
62
65 const std::string &GetMaxFanInNodeName() const {
66 return _maxFanInNodeName;
67 }
68
71 size_t GetMaxFanOut() const { return _maxFanOut; }
72
75 const std::string &GetMaxFanOutNodeName() const {
76 return _maxFanOutNodeName;
77 }
78
81 const _TypeStatsMap &GetStatsMap() const { return _statsMap; }
82
83private:
84
85
86 // The length of the longest encountered type name.
87 size_t _maxTypeNameLength;
88
89 // The max number of inputs into a node and the node where it was
90 // encountered.
91 size_t _maxFanIn;
92 std::string _maxFanInNodeName;
93
94 // The max number of outputs out of a ndoe and the node where it was
95 // encountered.
96 size_t _maxFanOut;
97 std::string _maxFanOutNodeName;
98
99};
100
102
103PXR_NAMESPACE_CLOSE_SCOPE
104
105#endif
A VdfNetwork is a collection of VdfNodes and their connections.
Definition: network.h:60
A VdfNetworkStats object represents some useful statistics about a network.
Definition: networkStats.h:31
size_t GetMaxTypeNameLength() const
Returns the length of the longest type name encountered.
Definition: networkStats.h:57
const std::string & GetMaxFanOutNodeName() const
Returns the node name with the max fan out.
Definition: networkStats.h:75
VDF_API VdfNetworkStats(const VdfNetwork &network)
Builds the statistics structures from the given network.
size_t GetMaxFanIn() const
Returns the max fan in.
Definition: networkStats.h:61
const std::string & GetMaxFanInNodeName() const
Returns the node name with the max fan in.
Definition: networkStats.h:65
const _TypeStatsMap & GetStatsMap() const
Returns the count map.
Definition: networkStats.h:81
size_t GetMaxFanOut() const
Returns the max fan out.
Definition: networkStats.h:71