Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-05-02 15:55:33 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-05-02 18:09:44 +0300
commitb6aa8a71fd8b12306ced2281805d70a24a6fc288 (patch)
treef4f5806e7cd0453cfd939603e6a2b626c753228b /source/blender/depsgraph/intern
parent651a2559318a5e8f3546286a207a5766e33feebe (diff)
Depsgraph: Add per-depsgraph debug name which is shown in the logs
This way we can see for which depsgraph datablock is being evaluated for.
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc58
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h1
-rw-r--r--source/blender/depsgraph/intern/depsgraph_debug.cc15
-rw-r--r--source/blender/depsgraph/intern/depsgraph_intern.h5
4 files changed, 73 insertions, 6 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index d75e3b9b3c8..bae798b82f7 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -602,6 +602,21 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
/* Evaluation and debug */
+static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
+{
+ const char *name = DEG_debug_name_get(depsgraph);
+ if (name[0] == '\0') {
+ return "";
+ }
+ return "[" + DEG::string(name) + "]: ";
+}
+
+void DEG_debug_print_begin(struct Depsgraph *depsgraph)
+{
+ fprintf(stdout, "%s",
+ depsgraph_name_for_logging(depsgraph).c_str());
+}
+
void DEG_debug_print_eval(struct Depsgraph *depsgraph,
const char *function_name,
const char *object_name,
@@ -611,7 +626,8 @@ void DEG_debug_print_eval(struct Depsgraph *depsgraph,
return;
}
fprintf(stdout,
- "%s on %s %s(%p)%s\n",
+ "%s%s on %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::deg_color_for_pointer(object_address).c_str(),
@@ -632,7 +648,8 @@ void DEG_debug_print_eval_subdata(struct Depsgraph *depsgraph,
return;
}
fprintf(stdout,
- "%s on %s %s(%p)%s %s %s %s(%p)%s\n",
+ "%s%s on %s %s(%p)%s %s %s %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::deg_color_for_pointer(object_address).c_str(),
@@ -659,7 +676,8 @@ void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph,
return;
}
fprintf(stdout,
- "%s on %s %s(%p)^%s %s %s[%d] %s(%p)%s\n",
+ "%s%s on %s %s(%p)%s %s %s[%d] %s(%p)%s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
function_name,
object_name,
DEG::deg_color_for_pointer(object_address).c_str(),
@@ -674,6 +692,37 @@ void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph,
fflush(stdout);
}
+void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph,
+ const char *function_name,
+ const char *object_name,
+ const void *object_address,
+ const char *object_type,
+ const char *parent_comment,
+ const char *parent_name,
+ const void *parent_address,
+ const char *parent_type)
+{
+ if ((DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_EVAL) == 0) {
+ return;
+ }
+ fprintf(stdout,
+ "%s%s on %s %s(%p)%s [%s] %s %s %s(%p)%s %s\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ function_name,
+ object_name,
+ DEG::deg_color_for_pointer(object_address).c_str(),
+ object_address,
+ object_type,
+ DEG::deg_color_end().c_str(),
+ parent_comment,
+ parent_name,
+ DEG::deg_color_for_pointer(parent_address).c_str(),
+ parent_address,
+ DEG::deg_color_end().c_str(),
+ parent_type);
+ fflush(stdout);
+}
+
void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
const char *function_name,
const char *object_name,
@@ -684,7 +733,8 @@ void DEG_debug_print_eval_time(struct Depsgraph *depsgraph,
return;
}
fprintf(stdout,
- "%s on %s %s(%p)%s at time %f\n",
+ depsgraph_name_for_logging(depsgraph).c_str(),
+ "%s%s on %s %s(%p)%s at time %f\n",
function_name,
object_name,
DEG::deg_color_for_pointer(object_address).c_str(),
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 9c61b9a1fc6..7b6af9deee1 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -205,6 +205,7 @@ struct Depsgraph {
/* NITE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
int debug_flags;
+ string debug_name;
};
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cc b/source/blender/depsgraph/intern/depsgraph_debug.cc
index 6b74c11ed70..f7adaafe5b3 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cc
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cc
@@ -45,6 +45,7 @@ extern "C" {
#include "DEG_depsgraph_query.h"
#include "intern/depsgraph_intern.h"
+#include "intern/depsgraph_types.h"
#include "intern/nodes/deg_node_id.h"
#include "intern/nodes/deg_node_time.h"
@@ -64,6 +65,20 @@ int DEG_debug_flags_get(const Depsgraph *depsgraph)
return deg_graph->debug_flags;
}
+void DEG_debug_name_set(struct Depsgraph *depsgraph, const char *name)
+{
+ DEG::Depsgraph *deg_graph =
+ reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+ deg_graph->debug_name = name;
+}
+
+const char *DEG_debug_name_get(struct Depsgraph *depsgraph)
+{
+ const DEG::Depsgraph *deg_graph =
+ reinterpret_cast<const DEG::Depsgraph *>(depsgraph);
+ return deg_graph->debug_name.c_str();
+}
+
bool DEG_debug_compare(const struct Depsgraph *graph1,
const struct Depsgraph *graph2)
{
diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
index f69ddeed355..c048a7c1b93 100644
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ b/source/blender/depsgraph/intern/depsgraph_intern.h
@@ -117,14 +117,15 @@ void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
do { \
if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_ ## type) { \
- fprintf(stderr, __VA_ARGS__); \
+ DEG_debug_print_begin(depsgraph); \
+ fprintf(stdout, __VA_ARGS__); \
} \
} while (0)
#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
do { \
if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
- fprintf(stderr, __VA_ARGS__); \
+ fprintf(stdout, __VA_ARGS__); \
} \
} while (0)