[Bf-blender-cvs] [f29ff14d6e3] blender2.8: Depsgraph: Remove bunch of debug code

Sergey Sharybin noreply at git.blender.org
Wed Oct 25 11:27:00 CEST 2017


Commit: f29ff14d6e369d77878769329fc6b08478a54a03
Author: Sergey Sharybin
Date:   Tue Oct 24 16:00:50 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBf29ff14d6e369d77878769329fc6b08478a54a03

Depsgraph: Remove bunch of debug code

Was never actually used and implementation seems to be slow: we shouldn't be
doing per-node evaluation hash lookups, adds too much overhead. We can instead
store statistics in the node itself, and maybe even group them somehow.

Ideally such a statistics should be user-friendly so riggers and animators
can see exactly what's happening.

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

M	source/blender/depsgraph/CMakeLists.txt
M	source/blender/depsgraph/DEG_depsgraph_debug.h
M	source/blender/depsgraph/intern/depsgraph_debug.cc
M	source/blender/depsgraph/intern/eval/deg_eval.cc
D	source/blender/depsgraph/intern/eval/deg_eval_debug.cc
D	source/blender/depsgraph/intern/eval/deg_eval_debug.h

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

diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 33a7628c68d..ac8d01ab739 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -53,7 +53,6 @@ set(SRC
 	intern/builder/deg_builder_transitive.cc
 	intern/debug/deg_debug_graphviz.cc
 	intern/eval/deg_eval.cc
-	intern/eval/deg_eval_debug.cc
 	intern/eval/deg_eval_flush.cc
 	intern/nodes/deg_node.cc
 	intern/nodes/deg_node_component.cc
@@ -78,7 +77,6 @@ set(SRC
 	intern/builder/deg_builder_relations.h
 	intern/builder/deg_builder_transitive.h
 	intern/eval/deg_eval.h
-	intern/eval/deg_eval_debug.h
 	intern/eval/deg_eval_flush.h
 	intern/nodes/deg_node.h
 	intern/nodes/deg_node_component.h
diff --git a/source/blender/depsgraph/DEG_depsgraph_debug.h b/source/blender/depsgraph/DEG_depsgraph_debug.h
index 0d19b8e1e97..63ebe21d073 100644
--- a/source/blender/depsgraph/DEG_depsgraph_debug.h
+++ b/source/blender/depsgraph/DEG_depsgraph_debug.h
@@ -39,45 +39,11 @@
 extern "C" {
 #endif
 
-struct GHash;
-struct ID;
-
 struct Depsgraph;
 
-/* ************************************************ */
-/* Statistics */
-
-typedef struct DepsgraphStatsTimes {
-	float duration_last;
-} DepsgraphStatsTimes;
-
-typedef struct DepsgraphStatsComponent {
-	struct DepsgraphStatsComponent *next, *prev;
-	
-	char name[64];
-	DepsgraphStatsTimes times;
-} DepsgraphStatsComponent;
-
-typedef struct DepsgraphStatsID {
-	struct ID *id;
-	
-	DepsgraphStatsTimes times;
-	ListBase components;
-} DepsgraphStatsID;
-
-typedef struct DepsgraphStats {
-	struct GHash *id_stats;
-} DepsgraphStats;
-
-struct DepsgraphStats *DEG_stats(void);
-
-void DEG_stats_verify(void);
-
-struct DepsgraphStatsID *DEG_stats_id(struct ID *id);
-
 /* ------------------------------------------------ */
 
-void DEG_stats_simple(const struct Depsgraph *graph, 
+void DEG_stats_simple(const struct Depsgraph *graph,
                       size_t *r_outer,
                       size_t *r_operations,
                       size_t *r_relations);
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc
index 388b692d742..0b1156a78ba 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -41,30 +41,9 @@ extern "C" {
 #include "DEG_depsgraph_debug.h"
 #include "DEG_depsgraph_build.h"
 
-#include "intern/eval/deg_eval_debug.h"
 #include "intern/depsgraph_intern.h"
 #include "util/deg_util_foreach.h"
 
-/* ************************************************ */
-
-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)
 {
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 98b10718404..49ec68405f7 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -47,7 +47,6 @@ extern "C" {
 
 #include "atomic_ops.h"
 
-#include "intern/eval/deg_eval_debug.h"
 #include "intern/eval/deg_eval_flush.h"
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
@@ -341,15 +340,11 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
 	}
 #endif
 
-	DepsgraphDebug::eval_begin(eval_ctx);
-
 	schedule_graph(task_pool, graph, layers);
 
 	BLI_task_pool_work_and_wait(task_pool);
 	BLI_task_pool_free(task_pool);
 
-	DepsgraphDebug::eval_end(eval_ctx);
-
 	/* Clear any uncleared tags - just in case. */
 	deg_graph_clear_tags(graph);
 
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_debug.cc b/source/blender/depsgraph/intern/eval/deg_eval_debug.cc
deleted file mode 100644
index 23f4adbaacd..00000000000
--- a/source/blender/depsgraph/intern/eval/deg_eval_debug.cc
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2014 Blender Foundation.
- * All rights reserved.
- *
- * Original Author: Lukas Toenne
- * Contributor(s): None Yet
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/depsgraph/intern/eval/deg_eval_debug.cc
- *  \ingroup depsgraph
- *
- * Implementation of tools for debugging the depsgraph
- */
-
-#include "intern/eval/deg_eval_debug.h"
-
-#include <cstring>  /* required for STREQ later on. */
-
-#include "BLI_listbase.h"
-#include "BLI_ghash.h"
-
-extern "C" {
-#include "WM_api.h"
-#include "WM_types.h"
-}  /* extern "C" */
-
-#include "DEG_depsgraph_debug.h"
-
-#include "intern/nodes/deg_node.h"
-#include "intern/nodes/deg_node_component.h"
-#include "intern/nodes/deg_node_operation.h"
-#include "intern/depsgraph_intern.h"
-
-namespace DEG {
-
-DepsgraphStats *DepsgraphDebug::stats = NULL;
-
-static string get_component_name(eDepsNode_Type type, const char *name = "")
-{
-	DepsNodeFactory *factory = deg_get_node_factory(type);
-	if (name[0] != '\0') {
-		return string(factory->tname());
-	}
-	else {
-		return string(factory->tname()) + " | " + name;
-	}
-}
-
-static void times_clear(DepsgraphStatsTimes &times)
-{
-	times.duration_last = 0.0f;
-}
-
-static void times_add(DepsgraphStatsTimes &times, float time)
-{
-	times.duration_last += time;
-}
-
-void DepsgraphDebug::eval_begin(const EvaluationContext *UNUSED(eval_ctx))
-{
-	/* TODO(sergey): Stats are currently globally disabled. */
-	/* verify_stats(); */
-	reset_stats();
-}
-
-void DepsgraphDebug::eval_end(const EvaluationContext *UNUSED(eval_ctx))
-{
-	WM_main_add_notifier(NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
-}
-
-void DepsgraphDebug::eval_step(const EvaluationContext *UNUSED(eval_ctx),
-                               const char *message)
-{
-#ifdef DEG_DEBUG_BUILD
-	if (deg_debug_eval_cb)
-		deg_debug_eval_cb(deg_debug_eval_userdata, message);
-#else
-	(void)message;  /* Ignored. */
-#endif
-}
-
-void DepsgraphDebug::task_started(Depsgraph *graph,
-                                  const OperationDepsNode *node)
-{
-	if (stats) {
-		BLI_spin_lock(&graph->lock);
-
-		ComponentDepsNode *comp = node->owner;
-		ID *id = comp->owner->id;
-
-		DepsgraphStatsID *id_stats = get_id_stats(id, true);
-		times_clear(id_stats->times);
-
-		/* XXX TODO use something like: if (id->flag & ID_DEG_DETAILS) {...} */
-		if (0) {
-			/* XXX component name usage needs cleanup! currently mixes identifier
-			 * and description strings!
-			 */
-			DepsgraphStatsComponent *comp_stats =
-			        get_component_stats(id, get_component_name(comp->type,
-			                                                   comp->name).c_str(),
-			                            true);
-			times_clear(comp_stats->times);
-		}
-
-		BLI_spin_unlock(&graph->lock);
-	}
-}
-
-void DepsgraphDebug::task_completed(Depsgraph *graph,
-                                    const OperationDepsNode *node,
-                                    double time)
-{
-	if (stats) {
-		BLI_spin_lock(&graph->lock);
-
-		ComponentDepsNode *comp = node->owner;
-		ID *id = comp->owner->id;
-
-		DepsgraphStatsID *id_stats = get_id_stats(id, true);
-		times_add(id_stats->times, time);
-
-		/* XXX TODO use something like: if (id->flag & ID_DEG_DETAILS) {...} */
-		if (0) {
-			/* XXX component name usage needs cleanup! currently mixes identifier
-			 * and description strings!
-			 */
-			DepsgraphStatsComponent *comp_stats =
-			        get_component_stats(id,
-			                            get_component_name(comp->type,
-			                                               comp->name).c_str(),
-			                            true);
-			times_add(comp_stats->times, time);
-		}
-
-		BLI_spin_unlock(&graph->lock);
-	}
-}
-
-/* ********** */
-/* Statistics */
-
-
-/* GHash callback */
-static void deg_id_stats_free(void *val)
-{
-	DepsgraphStatsID *id_stats = (DepsgraphStatsID *)val;
-
-	if (id_stats) {
-		BLI_freelistN(&id_stats->components);
-		MEM_freeN(id_stats);
-	}
-}
-
-void DepsgraphDebug::stats_init()
-{
-	if (!stats) {
-		stats = (DepsgraphStats *)MEM_callocN(sizeof(DepsgraphStats),
-		                                      "Depsgraph Stats");
-		stats->id_stats = BLI_ghash_new(BLI_ghashutil_ptrhash,
-		                                BLI_ghashutil_ptrcmp,
-		                                "Depsgraph ID Stats Hash");
-	}
-}
-
-void DepsgraphDebug::stats_free()
-{
-	if (stats) {
-		BLI_ghash_free(stats->id_stats, NULL, deg_id_stats_free);
-		MEM_freeN(stats);
-		stats = NULL;
-	}
-}
-
-void DepsgraphDebug::verify_stats()
-{
-	stats_init();
-}
-
-void DepsgraphDebug::reset_stats()
-{
-	if (!stats) {
-		return;
-	}
-
-	/* XXX this doesn't work, will immediately clear all info,
-	 * since most depsgraph updates have none or very few updates to handle.
-	 *
-	 * Could consider clearing only zero-user ID blocks here
-	 */
-//	BLI_ghash_clear(stats->id_stats, NULL, deg_id_stats_free);
-}
-
-DepsgraphStatsID *DepsgraphDebug::get_id_stats(ID *id, bool create)
-{
-	DepsgraphStatsID *id_stats = (DepsgraphStatsID *)BLI_ghash_lookup(stats->id_stats, id);
-
-	if (!id_stats && create) {
-		id_stats = (DepsgraphStatsID *)MEM_callocN(sizeof(DepsgraphStatsID),
-		                                           "Depsgraph ID Stats");
-		id_stats->id = id;
-
-		BLI_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list