Evas filters: Move DEBUG_TIME macro to be used in the main file
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 11 Mar 2014 05:50:11 +0000 (14:50 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 12 Mar 2014 05:08:02 +0000 (14:08 +0900)
Optimization can happen at a higher level than the blur function
itself... so let's measure the whole filter running time.

src/lib/evas/filters/evas_filter.c
src/lib/evas/filters/evas_filter_blur.c
src/lib/evas/filters/evas_filter_private.h

index a040255..59d5653 100644 (file)
@@ -1794,6 +1794,8 @@ _filter_chain_run(Evas_Filter_Context *ctx)
    Evas_Filter_Command *cmd;
    Eina_Bool ok = EINA_FALSE;
 
+   DEBUG_TIME_BEGIN();
+
    ctx->running = EINA_TRUE;
    EINA_INLIST_FOREACH(ctx->commands, cmd)
      {
@@ -1809,6 +1811,7 @@ _filter_chain_run(Evas_Filter_Context *ctx)
 
 end:
    ctx->running = EINA_FALSE;
+   DEBUG_TIME_END();
    return ok;
 }
 
index 747ac22..2e684f5 100644 (file)
@@ -4,15 +4,6 @@
 #include <math.h>
 #include <time.h>
 
-// Enable debug if you're working on optimizations
-#define DEBUG_TIME 1
-
-// Windows build will break if CLOCK_MONOTONIC is used
-#if !defined(_POSIX_MONOTONIC_CLOCK) || (_POSIX_MONOTONIC_CLOCK < 0)
-# undef DEBUG_TIME
-# define DEBUG_TIME 0
-#endif
-
 #if DIV_USING_BITSHIFT
 static int
 _smallest_pow2_larger_than(int val)
@@ -39,20 +30,6 @@ _smallest_pow2_larger_than(int val)
 # define DIVIDE_BY_DIAMETER(val) ((val) / diameter)
 #endif
 
-#if DEBUG_TIME
-# define DEBUG_TIME_BEGIN() \
-   struct timespec ts1, ts2; \
-   clock_gettime(CLOCK_MONOTONIC, &ts1);
-# define DEBUG_TIME_END() \
-   clock_gettime(CLOCK_MONOTONIC, &ts2); \
-   long long int t = 1000000LL * (ts2.tv_sec - ts1.tv_sec) \
-   + (ts2.tv_nsec - ts1.tv_nsec) / 1000LL; \
-   INF("TIME SPENT: %lldus", t);
-#else
-# define DEBUG_TIME_BEGIN() do {} while(0)
-# define DEBUG_TIME_END() do {} while(0)
-#endif
-
 /* RGBA functions */
 
 static void
index 45cc5c2..68c6b82 100644 (file)
 #define GREEN_OF(a) (((a) >> 8) & 0xff)
 #define BLUE_OF(a)  ((a) & 0xff)
 
+// Enable debug if you're working on optimizations
+#define DEBUG_TIME 1
+
+// Windows build will break if CLOCK_MONOTONIC is used
+#if !defined(_POSIX_MONOTONIC_CLOCK) || (_POSIX_MONOTONIC_CLOCK < 0)
+# undef DEBUG_TIME
+# define DEBUG_TIME 0
+#endif
+
 // The 'restrict' keyword is part of C99
 #if __STDC_VERSION__ < 199901L
 # define restrict
 #define BUFFERS_LOCK() do { if (cmd->input) cmd->input->locked = 1; if (cmd->output) cmd->output->locked = 1; if (cmd->mask) cmd->mask->locked = 1; } while (0)
 #define BUFFERS_UNLOCK() do { if (cmd->input) cmd->input->locked = 0; if (cmd->output) cmd->output->locked = 0; if (cmd->mask) cmd->mask->locked = 0; } while (0)
 
+#if DEBUG_TIME
+# define DEBUG_TIME_BEGIN() \
+   struct timespec ts1, ts2; \
+   clock_gettime(CLOCK_MONOTONIC, &ts1);
+# define DEBUG_TIME_END() \
+   clock_gettime(CLOCK_MONOTONIC, &ts2); \
+   long long int t = 1000000LL * (ts2.tv_sec - ts1.tv_sec) \
+   + (ts2.tv_nsec - ts1.tv_nsec) / 1000LL; \
+   INF("TIME SPENT: %lldus", t);
+#else
+# define DEBUG_TIME_BEGIN() do {} while(0)
+# define DEBUG_TIME_END() do {} while(0)
+#endif
+
 typedef enum _Evas_Filter_Interpolation_Mode Evas_Filter_Interpolation_Mode;
 
 struct _Evas_Filter_Context