diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_jobs.c | 11 | ||||
-rw-r--r-- | source/creator/creator.c | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 593b4afb85c..2d30844af80 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -119,7 +119,8 @@ enum { G_DEBUG_FFMPEG = (1 << 1), G_DEBUG_PYTHON = (1 << 2), /* extra python info */ G_DEBUG_EVENTS = (1 << 3), /* input/window/screen events */ - G_DEBUG_WM = (1 << 4) /* operator, undo */ + G_DEBUG_WM = (1 << 4), /* operator, undo */ + G_DEBUG_JOBS = (1 << 5) /* jobs time profiling */ }; #define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM) diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 73f59a5fbae..bd7b4694471 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -54,7 +54,7 @@ #include "wm_event_types.h" #include "wm.h" - +#include "PIL_time.h" /* ********************** Threaded Jobs Manager ****************************** */ @@ -127,6 +127,7 @@ struct wmJob { /* we use BLI_threads api, but per job only 1 thread runs */ ListBase threads; + double start_time; }; /* finds: @@ -343,6 +344,9 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *steve) /* restarted job has timer already */ if (steve->wt == NULL) steve->wt = WM_event_add_timer(wm, steve->win, TIMERJOBS, steve->timestep); + + if (G.debug & G_DEBUG_JOBS) + steve->start_time = PIL_check_seconds_timer(); } else printf("job fails, not initialized\n"); } @@ -465,6 +469,11 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) // if (steve->stop) printf("job ready but stopped %s\n", steve->name); // else printf("job finished %s\n", steve->name); + if (G.debug & G_DEBUG_JOBS) { + printf("Job '%s' finished in %f seconds\n", steve->name, + PIL_check_seconds_timer() - steve->start_time); + } + steve->running = 0; BLI_end_threads(&steve->threads); diff --git a/source/creator/creator.c b/source/creator/creator.c index 713c9220fd7..8c9cc45a050 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1144,6 +1144,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) #endif BLI_argsAdd(ba, 1, NULL, "--debug-value", "<value>\n\tSet debug value of <value> on startup\n", set_debug_value, NULL); + BLI_argsAdd(ba, 1, NULL, "--debug-jobs", "\n\tEnable time profiling for background jobs.", debug_mode_generic, (void *)G_DEBUG_JOBS); BLI_argsAdd(ba, 1, NULL, "--verbose", "<verbose>\n\tSet logging verbosity level.", set_verbosity, NULL); |