Revision: 35358
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35358
Author:   campbellbarton
Date:     2011-03-05 04:35:36 +0000 (Sat, 05 Mar 2011)
Log Message:
-----------
Utility defines for quick timing tests.
for most cases:
 TIMEIT_START(my_test)
 ....
 TIMEIT_END(my_test)

prints time, test name, function name and line number.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/PIL_time.h

Modified: trunk/blender/source/blender/blenlib/PIL_time.h
===================================================================
--- trunk/blender/source/blender/blenlib/PIL_time.h     2011-03-04 19:57:05 UTC 
(rev 35357)
+++ trunk/blender/source/blender/blenlib/PIL_time.h     2011-03-05 04:35:36 UTC 
(rev 35358)
@@ -56,9 +56,29 @@
         */
 void   PIL_sleep_ms                            (int ms);
 
+/** Utility defines for timing.
+ * requires BLI_utildefines.h for 'AT'
+ * TIMEIT_VALUE returns the time since TIMEIT_START was called.
+ */
+#define TIMEIT_START(var)                                                      
                                                \
+{                                                                              
                                                                        \
+       double _timeit_##var= PIL_check_seconds_timer();                        
                        \
+       printf("time start (" #var "):  " AT "\n");                             
                                \
+       fflush(stdout);                                                         
                                                        \
+       {                                                                       
                                                                        \
+
+
+#define TIMEIT_VALUE(var) (float)(PIL_check_seconds_timer() - _timeit_##var)
+
+
+#define TIMEIT_END(var)                                                        
                                                        \
+       }                                                                       
                                                                        \
+       printf("time end   (" #var "): %.6f" "  " AT "\n",      
TIMEIT_VAL(var));       \
+       fflush(stdout);                                                         
                                                        \
+}                                                                              
                                                                        \
+
 #ifdef __cplusplus
 }
 #endif
 
-#endif
-
+#endif /* !PIL_TIME_H */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to