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>2012-06-29 18:32:25 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-29 18:32:25 +0400
commit344ca17247accd2848081e69eab00ab7aac4a0ae (patch)
tree15de05fa03e3b8965fee704f3c38ce497a055bac /source/blender/windowmanager/intern/wm_jobs.c
parent70f50ed8fa9262e355aa468daf17eb7d9d3d348f (diff)
Added command line option "--debug-jobs"
This option enables time profiling of background jobs, namely it's measuring run time of the job and prints it to the console.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_jobs.c')
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c11
1 files changed, 10 insertions, 1 deletions
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);