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.
This commit is contained in:
Jean-Philippe Andre 2014-03-11 14:50:11 +09:00
parent a37a1d458d
commit 6674ef5b35
3 changed files with 26 additions and 23 deletions

View 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;
}

View 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

View File

@ -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