[Bf-blender-cvs] [a752bc148e8] master: Depsgraph: Make timing profile a command line option

Sergey Sharybin noreply at git.blender.org
Mon Mar 12 17:02:06 CET 2018


Commit: a752bc148e8704d594cf532074ecd3641061d0f2
Author: Sergey Sharybin
Date:   Mon Mar 12 17:01:02 2018 +0100
Branches: master
https://developer.blender.org/rBa752bc148e8704d594cf532074ecd3641061d0f2

Depsgraph: Make timing profile a command line option

This way we can add even more statistics, even one which will be print
to the console.

Would be nice if we also have verbosity level control.

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

M	source/blender/blenkernel/BKE_global.h
M	source/blender/depsgraph/intern/eval/deg_eval.cc
M	source/blender/python/intern/bpy_app.c
M	source/creator/creator_args.c

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

diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index f3d44164b1e..04b80cd34d4 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -125,12 +125,16 @@ enum {
 	G_DEBUG_DEPSGRAPH_BUILD      = (1 << 8),   /* depsgraph construction messages */
 	G_DEBUG_DEPSGRAPH_EVAL       = (1 << 9),   /* depsgraph evaluation messages */
 	G_DEBUG_DEPSGRAPH_TAG        = (1 << 10),  /* depsgraph tagging messages */
-	G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 11),  /* single threaded depsgraph */
-	G_DEBUG_DEPSGRAPH = (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_EVAL | G_DEBUG_DEPSGRAPH_TAG),
-	G_DEBUG_SIMDATA =   (1 << 12), /* sim debug data display */
-	G_DEBUG_GPU_MEM =   (1 << 13), /* gpu memory in status bar */
-	G_DEBUG_GPU =       (1 << 14), /* gpu debug */
-	G_DEBUG_IO = (1 << 15),   /* IO Debugging (for Collada, ...)*/
+	G_DEBUG_DEPSGRAPH_TIME       = (1 << 11),  /* single threaded depsgraph */
+	G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 12),  /* single threaded depsgraph */
+	G_DEBUG_DEPSGRAPH = (G_DEBUG_DEPSGRAPH_BUILD |
+	                     G_DEBUG_DEPSGRAPH_EVAL |
+	                     G_DEBUG_DEPSGRAPH_TAG |
+	                     G_DEBUG_DEPSGRAPH_TIME),
+	G_DEBUG_SIMDATA =   (1 << 13), /* sim debug data display */
+	G_DEBUG_GPU_MEM =   (1 << 14), /* gpu memory in status bar */
+	G_DEBUG_GPU =       (1 << 15), /* gpu debug */
+	G_DEBUG_IO = (1 << 16),   /* IO Debugging (for Collada, ...)*/
 };
 
 #define G_DEBUG_ALL  (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 18ad4d15985..5f7bb4c3de5 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -260,6 +260,7 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
 	                 __func__,
 	                 layers,
 	                 graph->layers);
+	const bool do_time_debug = ((G.debug & G_DEBUG_DEPSGRAPH_TIME) != 0);
 	/* Set time for the current graph evaluation context. */
 	TimeSourceDepsNode *time_src = graph->find_time_source();
 	eval_ctx->ctime = time_src->cfra;
@@ -268,7 +269,7 @@ void deg_evaluate_on_refresh(EvaluationContext *eval_ctx,
 	state.eval_ctx = eval_ctx;
 	state.graph = graph;
 	state.layers = layers;
-	state.do_stats = (G.debug_value != 0);
+	state.do_stats = do_time_debug;
 	/* Set up task scheduler and pull for threaded evaluation. */
 	TaskScheduler *task_scheduler;
 	bool need_free_scheduler;
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index c5ff2592746..ec77dc07ba7 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -360,6 +360,7 @@ static PyGetSetDef bpy_app_getsets[] = {
 	{(char *)"debug_depsgraph_build", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_BUILD},
 	{(char *)"debug_depsgraph_eval", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_EVAL},
 	{(char *)"debug_depsgraph_tag", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_TAG},
+	{(char *)"debug_depsgraph_time", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_DEPSGRAPH_TIME},
 	{(char *)"debug_simdata",   bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_SIMDATA},
 	{(char *)"debug_gpumem",    bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG_GPU_MEM},
 
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 99fa876d64d..04a8ae8c28f 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -755,6 +755,8 @@ static const char arg_handle_debug_mode_generic_set_doc_depsgraph_build[] =
 "\n\tEnable debug messages from dependency graph related on graph construction.";
 static const char arg_handle_debug_mode_generic_set_doc_depsgraph_tag[] =
 "\n\tEnable debug messages from dependency graph related on tagging.";
+static const char arg_handle_debug_mode_generic_set_doc_depsgraph_time[] =
+"\n\tEnable debug messages from dependency graph related on timing.";
 static const char arg_handle_debug_mode_generic_set_doc_depsgraph_eval[] =
 "\n\tEnable debug messages from dependency graph related on evaluation.";
 static const char arg_handle_debug_mode_generic_set_doc_depsgraph_no_threads[] =
@@ -1872,6 +1874,8 @@ void main_args_setup(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
 	            CB_EX(arg_handle_debug_mode_generic_set, depsgraph_eval), (void *)G_DEBUG_DEPSGRAPH_EVAL);
 	BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph-tag",
 	            CB_EX(arg_handle_debug_mode_generic_set, depsgraph_tag), (void *)G_DEBUG_DEPSGRAPH_TAG);
+	BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph-time",
+	            CB_EX(arg_handle_debug_mode_generic_set, depsgraph_time), (void *)G_DEBUG_DEPSGRAPH_TIME);
 	BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph-no-threads",
 	            CB_EX(arg_handle_debug_mode_generic_set, depsgraph_no_threads), (void *)G_DEBUG_DEPSGRAPH_NO_THREADS);
 	BLI_argsAdd(ba, 1, NULL, "--debug-gpumem",



More information about the Bf-blender-cvs mailing list