Measure build time...
authorAndre Susano Pinto <andresusanopinto@gmail.com>
Tue, 30 Jun 2009 01:17:50 +0000 (01:17 +0000)
committerAndre Susano Pinto <andresusanopinto@gmail.com>
Tue, 30 Jun 2009 01:17:50 +0000 (01:17 +0000)
*as expected it's a lot faster on BVH

source/blender/render/intern/include/rayobject.h
source/blender/render/intern/source/rayshade.c

index 064341ae18b176cf2c05261a99dc558b583edaa5..53d96d6331fce36caf51797a59d8cda0df8eef17 100644 (file)
@@ -120,4 +120,31 @@ int RE_rayobject_intersect(RayObject *r, Isect *i);
 
 #define ISECT_EPSILON ((float)FLT_EPSILON)
 
+
+
+#if !defined(_WIN32)
+
+#include <sys/time.h>
+#include <time.h>
+#include <stdio.h>
+
+#define BENCH(a,name)  \
+       do {                    \
+               double _t1, _t2;                                \
+               struct timeval _tstart, _tend;  \
+               clock_t _clock_init = clock();  \
+               gettimeofday ( &_tstart, NULL); \
+               (a);                                                    \
+               gettimeofday ( &_tend, NULL);   \
+               _t1 = ( double ) _tstart.tv_sec + ( double ) _tstart.tv_usec/ ( 1000*1000 );    \
+               _t2 = ( double )   _tend.tv_sec + ( double )   _tend.tv_usec/ ( 1000*1000 );    \
+               printf("BENCH:%s: %fs (real) %fs (cpu)\n", #name, _t2-_t1, (float)(clock()-_clock_init)/CLOCKS_PER_SEC);\
+       } while(0)
+#else
+
+#define BENCH(a)       (a)
+
+#endif
+
+
 #endif
index 66afb7510a4c4796d8612479c98ac3d2ddcee623..3fe3ac8690b2383d00328a11664599c33445c036 100644 (file)
@@ -320,9 +320,9 @@ static void makeraytree_single(Render *re)
 void makeraytree(Render *re)
 {
        if(ELEM(re->r.raystructure, R_RAYSTRUCTURE_SINGLE_BVH, R_RAYSTRUCTURE_SINGLE_OCTREE))
-               makeraytree_single(re);
+               BENCH(makeraytree_single(re), tree_build);
        else
-               makeraytree_hier(re);
+               BENCH(makeraytree_hier(re), tree_build);
 }