[Bf-blender-cvs] [5ce94f5] depsgraph_cleanup: Depsgraph: Move graphviz debugger to own file

Sergey Sharybin noreply at git.blender.org
Thu May 26 10:02:50 CEST 2016


Commit: 5ce94f5f2564f1391d3e3bcd5b6a71d6cb695061
Author: Sergey Sharybin
Date:   Thu May 26 09:46:21 2016 +0200
Branches: depsgraph_cleanup
https://developer.blender.org/rB5ce94f5f2564f1391d3e3bcd5b6a71d6cb695061

Depsgraph: Move graphviz debugger to own file

We might want to add more debugging methods, so makes sense to have
dedicated folder for all of them.

===================================================================

M	source/blender/depsgraph/CMakeLists.txt
M	source/blender/depsgraph/DEG_depsgraph_build.h
M	source/blender/depsgraph/DEG_depsgraph_debug.h
M	source/blender/depsgraph/DEG_depsgraph_query.h
A	source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
M	source/blender/depsgraph/intern/depsgraph_debug.cc

===================================================================

diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index b698437..c220604 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -45,6 +45,7 @@ set(SRC
 	intern/builder/deg_builder.cc
 	intern/builder/deg_builder_nodes.cc
 	intern/builder/deg_builder_relations.cc
+	intern/debug/deg_debug_graphviz.cc
 	intern/eval/deg_eval.cc
 	intern/eval/deg_eval_debug.cc
 	intern/eval/deg_eval_flush.cc
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index f680c47..49b648c 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -43,9 +43,6 @@ struct Depsgraph;
 struct Main;
 struct Scene;
 
-struct PointerRNA;
-struct PropertyRNA;
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h
index 374fad6..0d19b8e 100644
--- a/source/blender/depsgraph/DEG_depsgraph_debug.h
+++ b/source/blender/depsgraph/DEG_depsgraph_debug.h
@@ -39,13 +39,10 @@
 extern "C" {
 #endif
 
-struct DepsgraphSettings;
 struct GHash;
 struct ID;
 
 struct Depsgraph;
-struct DepsNode;
-struct DepsRelation;
 
 /* ************************************************ */
 /* Statistics */
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 6862586..ccd204a 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -19,7 +19,7 @@
  * All rights reserved.
  *
  * Original Author: Joshua Leung
- * Contributor(s): None Yet
+ * Contributor(s): Sergey Sharybin
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -33,12 +33,9 @@
 #ifndef __DEG_DEPSGRAPH_QUERY_H__
 #define __DEG_DEPSGRAPH_QUERY_H__
 
-struct ListBase;
 struct ID;
 
 struct Depsgraph;
-struct DepsNode;
-struct DepsRelation;
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
similarity index 75%
copy from source/blender/depsgraph/intern/depsgraph_debug.cc
copy to source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
index 4739c05..d389b8f 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
@@ -24,7 +24,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/depsgraph/intern/depsgraph_debug.cc
+/** \file blender/depsgraph/intern/debug/deg_debug_graphviz.cc
  *  \ingroup depsgraph
  *
  * Implementation of tools for debugging the depsgraph
@@ -35,15 +35,8 @@ extern "C" {
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_debug.h"
-#include "DEG_depsgraph_build.h"
 }  /* extern "C" */
 
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-
-#include "eval/deg_eval_debug.h"
-#include "depsgraph_debug.h"
 #include "depsgraph_intern.h"
 #include "depsgraph_util_foreach.h"
 
@@ -606,208 +599,3 @@ void DEG_debug_graphviz(const Depsgraph *graph, FILE *f, const char *label, bool
 }
 
 #undef NL
-
-/* ************************************************ */
-
-DepsgraphStats *DEG_stats(void)
-{
-	return DEG::DepsgraphDebug::stats;
-}
-
-void DEG_stats_verify()
-{
-	DEG::DepsgraphDebug::verify_stats();
-}
-
-DepsgraphStatsID *DEG_stats_id(ID *id)
-{
-	if (!DEG::DepsgraphDebug::stats) {
-		return NULL;
-	}
-	return DEG::DepsgraphDebug::get_id_stats(id, false);
-}
-
-bool DEG_debug_compare(const struct Depsgraph *graph1,
-                       const struct Depsgraph *graph2)
-{
-	BLI_assert(graph1 != NULL);
-	BLI_assert(graph2 != NULL);
-	const DEG::Depsgraph *deg_graph1 = reinterpret_cast<const DEG::Depsgraph *>(graph1);
-	const DEG::Depsgraph *deg_graph2 = reinterpret_cast<const DEG::Depsgraph *>(graph2);
-	if (deg_graph1->operations.size() != deg_graph2->operations.size()) {
-		return false;
-	}
-	/* TODO(sergey): Currently we only do real stupid check,
-	 * which is fast but which isn't 100% reliable.
-	 *
-	 * Would be cool to make it more robust, but it's good enough
-	 * for now. Also, proper graph check is actually NP-complex
-	 * problem..
-	 */
-	return true;
-}
-
-bool DEG_debug_scene_relations_validate(Main *bmain,
-                                        Scene *scene)
-{
-	Depsgraph *depsgraph = DEG_graph_new();
-	bool valid = true;
-	DEG_graph_build_from_scene(depsgraph, bmain, scene);
-	if (!DEG_debug_compare(depsgraph, scene->depsgraph)) {
-		fprintf(stderr, "ERROR! Depsgraph wasn't tagged for update when it should have!\n");
-		BLI_assert(!"This should not happen!");
-		valid = false;
-	}
-	DEG_graph_free(depsgraph);
-	return valid;
-}
-
-bool DEG_debug_consistency_check(Depsgraph *graph)
-{
-	const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
-
-	/* Validate links exists in both directions. */
-	foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
-		foreach (DEG::DepsRelation *rel, node->outlinks) {
-			int counter1 = 0;
-			foreach (DEG::DepsRelation *tmp_rel, node->outlinks) {
-				if (tmp_rel == rel) {
-					++counter1;
-				}
-			}
-
-			int counter2 = 0;
-			foreach (DEG::DepsRelation *tmp_rel, rel->to->inlinks) {
-				if (tmp_rel == rel) {
-					++counter2;
-				}
-			}
-
-			if (counter1 != counter2) {
-				printf("Relation exists in outgoing direction but not in incoming (%d vs. %d).\n",
-				       counter1, counter2);
-				return false;
-			}
-		}
-	}
-
-	foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
-		foreach (DEG::DepsRelation *rel, node->inlinks) {
-			int counter1 = 0;
-			foreach (DEG::DepsRelation *tmp_rel, node->inlinks) {
-				if (tmp_rel == rel) {
-					++counter1;
-				}
-			}
-
-			int counter2 = 0;
-			foreach (DEG::DepsRelation *tmp_rel, rel->from->outlinks) {
-				if (tmp_rel == rel) {
-					++counter2;
-				}
-			}
-
-			if (counter1 != counter2) {
-				printf("Relation exists in incoming direction but not in outcoming (%d vs. %d).\n",
-				       counter1, counter2);
-			}
-		}
-	}
-
-	/* Validate node valency calculated in both directions. */
-	foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
-		node->num_links_pending = 0;
-		node->done = 0;
-	}
-
-	foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
-		if (node->done) {
-			printf("Node %s is twice in the operations!\n",
-			       node->identifier().c_str());
-			return false;
-		}
-		foreach (DEG::DepsRelation *rel, node->outlinks) {
-			if (rel->to->type == DEG::DEPSNODE_TYPE_OPERATION) {
-				DEG::OperationDepsNode *to = (DEG::OperationDepsNode *)rel->to;
-				BLI_assert(to->num_links_pending < to->inlinks.size());
-				++to->num_links_pending;
-			}
-		}
-		node->done = 1;
-	}
-
-	foreach (DEG::OperationDepsNode *node, deg_graph->operations) {
-		int num_links_pending = 0;
-		foreach (DEG::DepsRelation *rel, node->inlinks) {
-			if (rel->from->type == DEG::DEPSNODE_TYPE_OPERATION) {
-				++num_links_pending;
-			}
-		}
-		if (node->num_links_pending != num_links_pending) {
-			printf("Valency mismatch: %s, %u != %d\n",
-			       node->identifier().c_str(),
-			       node->num_links_pending, num_links_pending);
-			printf("Number of inlinks: %d\n", (int)node->inlinks.size());
-			return false;
-		}
-	}
-	return true;
-}
-
-/* ------------------------------------------------ */
-
-/**
- * Obtain simple statistics about the complexity of the depsgraph
- * \param[out] r_outer       The number of outer nodes in the graph
- * \param[out] r_operations  The number of operation nodes in the graph
- * \param[out] r_relations   The number of relations between (executable) nodes in the graph
- */
-void DEG_stats_simple(const Depsgraph *graph, size_t *r_outer,
-                      size_t *r_operations, size_t *r_relations)
-{
-	const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
-
-	/* number of operations */
-	if (r_operations) {
-		/* All operations should be in this list, allowing us to count the total
-		 * number of nodes.
-		 */
-		*r_operations = deg_graph->operations.size();
-	}
-
-	/* Count number of outer nodes and/or relations between these. */
-	if (r_outer || r_relations) {
-		size_t tot_outer = 0;
-		size_t tot_rels = 0;
-
-		for (DEG::Depsgraph::IDNodeMap::const_iterator it = deg_graph->id_hash.begin();
-		     it != deg_graph->id_hash.end();
-		     ++it)
-		{
-			DEG::IDDepsNode *id_node = it->second;
-			tot_outer++;
-			for (DEG::IDDepsNode::ComponentMap::const_iterator it = id_node->components.begin();
-			     it != id_node->components.end();
-			     ++it)
-			{
-				DEG::ComponentDepsNode *comp_node = it->second;
-				tot_outer++;
-				for (DEG::ComponentDepsNode::OperationMap::const_iterator it = comp_node->operations.begin();
-				     it != comp_node->operations.end();
-				     ++it)
-				{
-					DEG::OperationDepsNode *op_node = it->second;
-					tot_rels += op_node->inlinks.size();
-				}
-			}
-		}
-
-		DEG::TimeSourceDepsNode *time_source = deg_graph->find_time_source(NULL);
-		if (time_source != NULL) {
-			tot_rels += time_source->inlinks.size();
-		}
-
-		if (r_relations) *r_relations = tot_rels;
-		if (r_outer)     *r_outer     = tot_outer;
-	}
-}
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc
index 4739c05..de78b4e 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -38,575 +38,10 @@ extern "C" {
 #include "DEG_depsgraph_build.h"
 }  /* extern "C" */
 
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-
 #include "eval/deg_eval_debug.h"
-#include "depsgraph_debug.h"
 #include "depsgraph_intern.h"
 #include "depsgraph_util_foreach.h"
 
-/* ****************** */
-/* Graphviz Debugging */
-
-namespace DEG {
-
-#define NL "\r\n"
-
-/* Only one should be enabled, defines whether graphviz nodes
- * get colored by individual types or classes.
- */
-#define COLOR_SCHEME_NODE_CLASS 1
-//#define COLOR_SCHEME

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list