diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-01-09 06:25:48 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-01-09 06:25:48 +0300 |
commit | cc0f5bf7ec4a072994633294b4cbea0cd7472a07 (patch) | |
tree | 5b239d1113982a0eece8231030b6b846edd7d8ab /source/blender/blenkernel/intern/smoke.c | |
parent | 85d675963665300d3049b42cc5d70547380557ee (diff) |
Cleanup: make use of PIL time instead of redefining own timers.
Also added a DEBUG_TIME macro in the related files to comment time funcs out.
Reviewers: brecht
Reviewed By: brecht
Subscribers: brecht
Differential Revision: https://developer.blender.org/D1717
Diffstat (limited to 'source/blender/blenkernel/intern/smoke.c')
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 63 |
1 files changed, 13 insertions, 50 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 29ae04bfd39..dae4a608031 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -90,57 +90,18 @@ /* UNUSED so far, may be enabled later */ /* #define USE_SMOKE_COLLISION_DM */ +//#define DEBUG_TIME + +#ifdef DEBUG_TIME +# include "PIL_time.h" +#endif + #include "smoke_API.h" #ifdef WITH_SMOKE static ThreadMutex object_update_lock = BLI_MUTEX_INITIALIZER; -#ifdef _WIN32 -#include <time.h> -#include <stdio.h> -#include <conio.h> -#include <windows.h> - -static LARGE_INTEGER liFrequency; -static LARGE_INTEGER liStartTime; -static LARGE_INTEGER liCurrentTime; - -static void tstart(void) -{ - QueryPerformanceFrequency(&liFrequency); - QueryPerformanceCounter(&liStartTime); -} -static void tend(void) -{ - QueryPerformanceCounter(&liCurrentTime); -} -static double UNUSED_FUNCTION(tval) (void) -{ - return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart) * (double)1000.0 / (double)liFrequency.QuadPart)); -} -#else -#include <sys/time.h> -static struct timeval _tstart, _tend; -static struct timezone tz; -static void tstart(void) -{ - gettimeofday(&_tstart, &tz); -} -static void tend(void) -{ - gettimeofday(&_tend, &tz); -} - -static double UNUSED_FUNCTION(tval) (void) -{ - double t1, t2; - t1 = ( double ) _tstart.tv_sec * 1000 + ( double ) _tstart.tv_usec / (1000); - t2 = ( double ) _tend.tv_sec * 1000 + ( double ) _tend.tv_usec / (1000); - return t2 - t1; -} -#endif - struct Object; struct Scene; struct DerivedMesh; @@ -806,8 +767,6 @@ static void obstacles_from_derivedmesh( float *vert_vel = NULL; bool has_velocity = false; - tstart(); - dm = CDDM_copy(scs->dm); CDDM_calc_normals(dm); mvert = dm->getVertArray(dm); @@ -2858,7 +2817,9 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object * if (framenr != scene->r.cfra) return; - tstart(); +#ifdef DEBUG_TIME + double start = PIL_check_seconds_timer(); +#endif /* if on second frame, write cache for first frame */ if ((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0)) { @@ -2899,8 +2860,10 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object * if (framenr != startframe) BKE_ptcache_write(&pid, framenr); - tend(); - // printf ( "Frame: %d, Time: %f\n\n", (int)smd->time, (float) tval() ); +#ifdef DEBUG_TIME + double end = PIL_check_seconds_timer(); + printf("Frame: %d, Time: %f\n\n", (int)smd->time, (float)(end - start)); +#endif } } |