[Bf-blender-cvs] [5643886] depsgraph_refactor: Added a central DepsgraphDebug class to hold the various reporting functions for debugging/logging/statistics.
Lukas Tönne
noreply at git.blender.org
Mon May 26 20:07:52 CEST 2014
Commit: 56438860959547a7f88977c2b9c40f48f2470f1b
Author: Lukas Tönne
Date: Mon May 26 19:24:12 2014 +0200
https://developer.blender.org/rB56438860959547a7f88977c2b9c40f48f2470f1b
Added a central DepsgraphDebug class to hold the various reporting
functions for debugging/logging/statistics.
This could eventually have multiple implementations, including a stub
for noop functions, and be passed as a top-level template parameter to
eliminate overhead as much as possible.
===================================================================
M source/blender/depsgraph/CMakeLists.txt
M source/blender/depsgraph/intern/depsgraph_debug.cpp
A source/blender/depsgraph/intern/depsgraph_debug.h
M source/blender/depsgraph/intern/depsgraph_eval.cpp
M source/blender/depsgraph/intern/depsnode_operation.h
M source/blender/depsgraph/util/depsgraph_util_task.cpp
===================================================================
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 2a52114..25bce3e 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -63,6 +63,7 @@ set(SRC
intern/depsnode_component.h
intern/depsnode_operation.h
intern/depsgraph_build.h
+ intern/depsgraph_debug.h
intern/depsgraph_eval.h
intern/depsgraph_intern.h
intern/depsgraph_queue.h
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index 9184e5b..a9ed63e 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -41,6 +41,8 @@ extern "C" {
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
+#include "BKE_idcode.h"
+
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_debug.h"
@@ -48,12 +50,14 @@ extern "C" {
#include "RNA_types.h"
} /* extern "C" */
+#include "depsgraph_debug.h"
#include "depsnode.h"
#include "depsnode_component.h"
#include "depsnode_operation.h"
#include "depsgraph_types.h"
#include "depsgraph_intern.h"
#include "depsgraph_queue.h"
+#include "depsgraph_util_task.h"
/* ************************************************ */
/* Graphviz Debugging */
@@ -733,3 +737,28 @@ void DEG_debug_eval_step(const char *message) {}
#endif /* DEG_DEBUG_BUILD */
/* ************************************************ */
+
+void DepsgraphDebug::eval_begin(eEvaluationContextType context_type)
+{
+
+}
+
+void DepsgraphDebug::eval_end(eEvaluationContextType context_type, double time)
+{
+
+}
+
+void DepsgraphDebug::task_started(const DepsgraphTask &task)
+{
+
+}
+
+void DepsgraphDebug::task_completed(const DepsgraphTask &task, double time)
+{
+ OperationDepsNode *node = task.node;
+ ComponentDepsNode *comp = node->owner;
+ ID *id = comp->owner->id;
+ printf("%s %s : %s took %f ms\n", BKE_idcode_to_name(GS(id->name)), id->name+2, comp->name.c_str(), time);
+}
+
+/* ************************************************ */
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.h b/source/blender/depsgraph/intern/depsgraph_debug.h
new file mode 100644
index 0000000..58da903
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_debug.h
@@ -0,0 +1,55 @@
+/*
+ * ***** 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) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ * "Operation Contexts" are used to pass state info (scene, parameter info, cfra)
+ * as well as the temporary data structure(s) that operations should perform their
+ * operations on. Thus, instead of operations potentially messing up state in places
+ * they shouldn't be touching, they are just provided with thread-safe micro-environments
+ * in which to work.
+ */
+
+#ifndef __DEPSGRAPH_DEBUG_H__
+#define __DEPSGRAPH_DEBUG_H__
+
+extern "C" {
+#include "DNA_userdef_types.h"
+}
+
+#include "DEG_depsgraph_debug.h"
+
+#include "DEG_depsgraph.h"
+
+struct Depsgraph;
+struct DepsgraphTask;
+
+struct DepsgraphDebug {
+ static void eval_begin(eEvaluationContextType context_type);
+ static void eval_end(eEvaluationContextType context_type, double time);
+
+ static void task_started(const DepsgraphTask &task);
+ static void task_completed(const DepsgraphTask &task, double time);
+};
+
+#endif // __DEPSGRAPH_DEBUG_H__
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cpp b/source/blender/depsgraph/intern/depsgraph_eval.cpp
index bb70808..d85cacc 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cpp
@@ -38,8 +38,6 @@ extern "C" {
#include "BLI_threads.h"
#include "BLI_utildefines.h"
-#include "PIL_time.h"
-
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/depsgraph/intern/depsnode_operation.h b/source/blender/depsgraph/intern/depsnode_operation.h
index ddfafa8..74c8625 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.h
+++ b/source/blender/depsgraph/intern/depsnode_operation.h
@@ -76,9 +76,6 @@ struct OperationDepsNode : public DepsNode {
Relations inlinks; /* nodes which this one depends on */
Relations outlinks; /* nodes which depend on this one */
- double start_time; /* (secs) last timestamp (in seconds) when operation was started */
- double last_time; /* (seconds) time in seconds that last evaluation took */
-
uint32_t num_links_pending; /* how many inlinks are we still waiting on before we can be evaluated... */
float eval_priority;
diff --git a/source/blender/depsgraph/util/depsgraph_util_task.cpp b/source/blender/depsgraph/util/depsgraph_util_task.cpp
index 9c279c6..9544bb1 100644
--- a/source/blender/depsgraph/util/depsgraph_util_task.cpp
+++ b/source/blender/depsgraph/util/depsgraph_util_task.cpp
@@ -27,6 +27,9 @@
#include <stdlib.h>
#include "BLI_utildefines.h"
+#include "PIL_time.h"
+
+#include "depsgraph_debug.h"
#include "depsnode_component.h"
#include "depsgraph_util_task.h"
@@ -56,7 +59,8 @@ void DepsgraphTask::run()
void *item = &node->ptr;
/* take note of current time */
-// node->start_time = PIL_check_seconds_timer();
+ double start_time = PIL_check_seconds_timer();
+ DepsgraphDebug::task_started(*this);
/* should only be the case for NOOPs, which never get to this point */
BLI_assert(node->evaluate);
@@ -64,7 +68,8 @@ void DepsgraphTask::run()
node->evaluate(context, item);
/* note how long this took */
-// node->last_time = PIL_check_seconds_timer() - node->start_time;
+ double end_time = PIL_check_seconds_timer();
+ DepsgraphDebug::task_completed(*this, end_time - start_time);
}
void DepsgraphTask::schedule_children(DepsgraphTaskPool *pool)
More information about the Bf-blender-cvs
mailing list