jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6674ef5b35f5e3e02347150673c577774287c8f2

commit 6674ef5b35f5e3e02347150673c577774287c8f2
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Tue Mar 11 14:50:11 2014 +0900

    Evas filters: Move DEBUG_TIME macro to be used in the main file
    
    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         |  3 +++
 src/lib/evas/filters/evas_filter_blur.c    | 23 -----------------------
 src/lib/evas/filters/evas_filter_private.h | 23 +++++++++++++++++++++++
 3 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/src/lib/evas/filters/evas_filter.c 
b/src/lib/evas/filters/evas_filter.c
index a040255..59d5653 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -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;
 }
 
diff --git a/src/lib/evas/filters/evas_filter_blur.c 
b/src/lib/evas/filters/evas_filter_blur.c
index 747ac22..2e684f5 100644
--- a/src/lib/evas/filters/evas_filter_blur.c
+++ b/src/lib/evas/filters/evas_filter_blur.c
@@ -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
diff --git a/src/lib/evas/filters/evas_filter_private.h 
b/src/lib/evas/filters/evas_filter_private.h
index 45cc5c2..68c6b82 100644
--- a/src/lib/evas/filters/evas_filter_private.h
+++ b/src/lib/evas/filters/evas_filter_private.h
@@ -29,6 +29,15 @@
 #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
@@ -41,6 +50,20 @@
 #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

-- 


Reply via email to