Revision: 59779
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59779
Author:   campbellbarton
Date:     2013-09-03 21:22:43 +0000 (Tue, 03 Sep 2013)
Log Message:
-----------
move timeit macros into their own include, since they are only used for testing 
and unrelated to PIL_time.h typical use.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/CMakeLists.txt
    trunk/blender/source/blender/blenlib/PIL_time.h
    trunk/blender/source/blender/bmesh/operators/bmo_beautify.c
    trunk/blender/source/blender/editors/space_view3d/drawvolume.c
    trunk/blender/source/blender/modifiers/intern/MOD_decimate.c
    trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c

Added Paths:
-----------
    trunk/blender/source/blender/blenlib/PIL_time_utildefines.h

Modified: trunk/blender/source/blender/blenlib/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/blenlib/CMakeLists.txt 2013-09-03 20:59:24 UTC 
(rev 59778)
+++ trunk/blender/source/blender/blenlib/CMakeLists.txt 2013-09-03 21:22:43 UTC 
(rev 59779)
@@ -162,6 +162,7 @@
        BLI_voxel.h
        BLI_winstuff.h
        PIL_time.h
+       PIL_time_utildefines.h
 )
 
 if(WITH_BINRELOC)

Modified: trunk/blender/source/blender/blenlib/PIL_time.h
===================================================================
--- trunk/blender/source/blender/blenlib/PIL_time.h     2013-09-03 20:59:24 UTC 
(rev 59778)
+++ trunk/blender/source/blender/blenlib/PIL_time.h     2013-09-03 21:22:43 UTC 
(rev 59779)
@@ -51,64 +51,8 @@
  */
 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);                                                 
      \
-               { (void)0
-
-#define TIMEIT_VALUE(var) (float)(PIL_check_seconds_timer() - _timeit_##var)
-
-#define TIMEIT_VALUE_PRINT(var)                                               \
-       {                                                                       
  \
-               printf("time update(" #var "): %.6f" "  " AT "\n", 
TIMEIT_VALUE(var));\
-               fflush(stdout);                                                 
      \
-       } (void)0
-
-#define TIMEIT_END(var)                                                       \
-       }                                                                       
  \
-       printf("time end   (" #var "): %.6f" "  " AT "\n", TIMEIT_VALUE(var));  
  \
-       fflush(stdout);                                                         
  \
-} (void)0
-
-/**
- * Given some function/expression:
- *   TIMEIT_BENCH(some_function(), some_unique_description);
- */
-#define TIMEIT_BENCH(expr, id)                                                \
-       {                                                                       
  \
-               TIMEIT_START(id);                                               
      \
-               (expr);                                                         
      \
-               TIMEIT_END(id);                                                 
      \
-       } (void)0
-
-#define TIMEIT_BLOCK_INIT(what) \
-       double _timeit_var_##what = 0; \
-       (void) 0
-
-#define TIMEIT_BLOCK_BEGIN(what) \
-       { \
-               double _timeit_block_start_##what = PIL_check_seconds_timer();  
\
-               { (void)0
-
-#define TIMEIT_BLOCK_END(what) \
-               } \
-               _timeit_var_##what += PIL_check_seconds_timer() - 
_timeit_block_start_##what; \
-       } (void)0
-
-#define TIMEIT_BLOCK_STATS(what) \
-       { \
-               printf("%s time (in seconds): %f\n", #what, 
_timeit_var_##what); \
-               fflush(stdout); \
-       } (void)0
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif  /* !__PIL_TIME_H__ */
+#endif  /* __PIL_TIME_H__ */

Added: trunk/blender/source/blender/blenlib/PIL_time_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/PIL_time_utildefines.h                 
        (rev 0)
+++ trunk/blender/source/blender/blenlib/PIL_time_utildefines.h 2013-09-03 
21:22:43 UTC (rev 59779)
@@ -0,0 +1,95 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton
+ *                 Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenlib/PIL_time_utildefines.h
+ *  \ingroup bli
+ *  \brief Utility defines for timing/benchmarks.
+ *
+ * \note requires BLI_utildefines.h for 'AT'.
+ */
+
+#ifndef __PIL_TIME_UTILDEFINES_H__
+#define __PIL_TIME_UTILDEFINES_H__
+
+#define TIMEIT_START(var)                                                     \
+       {                                                                       
  \
+               double _timeit_##var = PIL_check_seconds_timer();               
      \
+               printf("time start (" #var "):  " AT "\n");                     
      \
+               fflush(stdout);                                                 
      \
+               { (void)0
+
+/**
+ * \return the time since TIMEIT_START was called.
+ */
+#define TIMEIT_VALUE(var) (float)(PIL_check_seconds_timer() - _timeit_##var)
+
+#define TIMEIT_VALUE_PRINT(var)                                               \
+       {                                                                       
  \
+               printf("time update(" #var "): %.6f" "  " AT "\n", 
TIMEIT_VALUE(var));\
+               fflush(stdout);                                                 
      \
+       } (void)0
+
+#define TIMEIT_END(var)                                                       \
+       }                                                                       
  \
+       printf("time end   (" #var "): %.6f" "  " AT "\n", TIMEIT_VALUE(var));  
  \
+       fflush(stdout);                                                         
  \
+} (void)0
+
+/**
+ * Given some function/expression:
+ *   TIMEIT_BENCH(some_function(), some_unique_description);
+ */
+#define TIMEIT_BENCH(expr, id)                                                \
+       {                                                                       
  \
+               TIMEIT_START(id);                                               
      \
+               (expr);                                                         
      \
+               TIMEIT_END(id);                                                 
      \
+       } (void)0
+
+#define TIMEIT_BLOCK_INIT(id) \
+       double _timeit_var_##id = 0; \
+       (void) 0
+
+#define TIMEIT_BLOCK_START(id)                                                \
+       {                                                                       
  \
+               double _timeit_block_start_##id = PIL_check_seconds_timer();    
      \
+               { (void)0
+
+#define TIMEIT_BLOCK_END(id)                                                  \
+               }                                                               
      \
+               _timeit_var_##id += (PIL_check_seconds_timer() -                
      \
+                                    _timeit_block_start_##id);                 
      \
+       } (void)0
+
+#define TIMEIT_BLOCK_STATS(id)                                                \
+       {                                                                       
  \
+               printf("%s time (in seconds): %f\n", #id, _timeit_var_##id);    
      \
+               fflush(stdout);                                                 
      \
+       } (void)0
+
+#endif  /* __PIL_TIME_UTILDEFINES_H__ */


Property changes on: trunk/blender/source/blender/blenlib/PIL_time_utildefines.h
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: trunk/blender/source/blender/bmesh/operators/bmo_beautify.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_beautify.c 2013-09-03 
20:59:24 UTC (rev 59778)
+++ trunk/blender/source/blender/bmesh/operators/bmo_beautify.c 2013-09-03 
21:22:43 UTC (rev 59779)
@@ -47,6 +47,7 @@
 
 #ifdef DEBUG_TIME
 #  include "PIL_time.h"
+#  include "PIL_time_utildefines.h"
 #endif
 
 enum {

Modified: trunk/blender/source/blender/editors/space_view3d/drawvolume.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawvolume.c      
2013-09-03 20:59:24 UTC (rev 59778)
+++ trunk/blender/source/blender/editors/space_view3d/drawvolume.c      
2013-09-03 21:22:43 UTC (rev 59779)
@@ -83,6 +83,7 @@
 
 #ifdef DEBUG_DRAW_TIME
 #  include "PIL_time.h"
+#  include "PIL_time_utildefines.h"
 #endif
 
 static int intersect_edges(float *points, float a, float b, float c, float d, 
float edges[12][2][3])

Modified: trunk/blender/source/blender/modifiers/intern/MOD_decimate.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_decimate.c        
2013-09-03 20:59:24 UTC (rev 59778)
+++ trunk/blender/source/blender/modifiers/intern/MOD_decimate.c        
2013-09-03 21:22:43 UTC (rev 59779)
@@ -55,6 +55,7 @@
 
 #ifdef USE_TIMEIT
 #  include "PIL_time.h"
+#  include "PIL_time_utildefines.h"
 #endif
 
 #include "MOD_util.h"

Modified: trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c       
2013-09-03 20:59:24 UTC (rev 59778)
+++ trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c       
2013-09-03 21:22:43 UTC (rev 59779)
@@ -28,18 +28,12 @@
  *  \ingroup modifiers
  */
 
-#define DO_PROFILE 0
-
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 #include "BLI_math.h"
 #include "BLI_string.h"
 #include "BLI_rand.h"
 
-#if DO_PROFILE
-       #include "PIL_time.h"
-#endif
-
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
@@ -58,6 +52,13 @@
 #include "MOD_util.h"
 #include "MOD_weightvg_util.h"
 
+// #define USE_TIMEIT
+
+#ifdef USE_TIMEIT
+#  include "PIL_time.h"
+#  include "PIL_time_utildefines.h"
+#endif
+
 /**************************************
  * Util functions.                    *
  **************************************/
@@ -382,8 +383,8 @@
        int do_prev = (wmd->modifier.mode & eModifierMode_DoWeightPreview);
 #endif
 
-#if DO_PROFILE
-       TIMEIT_START(perf)
+#ifdef USE_TIMEIT
+       TIMEIT_START(perf);
 #endif
 
        /* Get number of verts. */
@@ -548,8 +549,8 @@
                MEM_freeN(indices);
        MEM_freeN(v_cos);
 

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to