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.
This commit is contained in:
Sergey Sharybin
2018-03-12 17:01:02 +01:00
parent 815852e950
commit a752bc148e
4 changed files with 17 additions and 7 deletions

View File

@@ -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 | \

View File

@@ -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;

View File

@@ -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},

View File

@@ -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",