diff options
Diffstat (limited to 'source/blender/depsgraph/intern/nodes')
-rw-r--r-- | source/blender/depsgraph/intern/nodes/deg_node.cc | 36 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/nodes/deg_node.h | 16 |
2 files changed, 45 insertions, 7 deletions
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc index e561c9b236e..d72ca384044 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node.cc +++ b/source/blender/depsgraph/intern/nodes/deg_node.cc @@ -44,10 +44,9 @@ namespace DEG { -/* *************** */ -/* Node Management */ - -/* Add ------------------------------------------------ */ +/******************************************************************************* + * Type information. + */ DepsNode::TypeInfo::TypeInfo(eDepsNode_Type type, const char *tname, @@ -58,6 +57,29 @@ DepsNode::TypeInfo::TypeInfo(eDepsNode_Type type, { } +/******************************************************************************* + * Evaluation statistics. + */ + +DepsNode::Stats::Stats() +{ + reset(); +} + +void DepsNode::Stats::reset() +{ + current_time = 0.0; +} + +void DepsNode::Stats::reset_current() +{ + current_time = 0.0; +} + +/******************************************************************************* + * Node itself. + */ + DepsNode::DepsNode() { name = ""; @@ -97,8 +119,10 @@ eDepsNode_Class DepsNode::get_class() const { } } -/* Generic Nodes */ - +/******************************************************************************* + * Generic nodes definition. + */ +\ DEG_DEPSNODE_DEFINE(TimeSourceDepsNode, DEG_NODE_TYPE_TIMESOURCE, "Time Source"); static DepsNodeFactoryImpl<TimeSourceDepsNode> DNTI_TIMESOURCE; diff --git a/source/blender/depsgraph/intern/nodes/deg_node.h b/source/blender/depsgraph/intern/nodes/deg_node.h index cc741224c71..603a6be7ceb 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node.h +++ b/source/blender/depsgraph/intern/nodes/deg_node.h @@ -56,6 +56,19 @@ struct DepsNode { const char *tname; int id_recalc_tag; }; + struct Stats { + Stats(); + /* Reset all the counters. Including all stats needed for average + * evaluation time calculation. + */ + void reset(); + /* Reset counters needed for the current graph evaluation, does not + * touch averaging accumulators. + */ + void reset_current(); + /* Time spend on this node during current graph evaluation. */ + double current_time; + }; /* Relationships between nodes * The reason why all depsgraph nodes are descended from this type (apart * from basic serialization benefits - from the typeinfo) is that we can have @@ -67,7 +80,8 @@ struct DepsNode { eDepsNode_Type type; /* Structural type of node. */ Relations inlinks; /* Nodes which this one depends on. */ Relations outlinks; /* Nodes which depend on this one. */ - int done; /* Generic tags for traversal algorithms. */ + int done; /* Generic tags for traversal algorithms. */ + Stats stats; /* Evaluation statistics. */ /* Methods. */ DepsNode(); |