forked from enlightenment/efl
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:
parent
a37a1d458d
commit
6674ef5b35
|
@ -1794,6 +1794,8 @@ _filter_chain_run(Evas_Filter_Context *ctx)
|
||||||
Evas_Filter_Command *cmd;
|
Evas_Filter_Command *cmd;
|
||||||
Eina_Bool ok = EINA_FALSE;
|
Eina_Bool ok = EINA_FALSE;
|
||||||
|
|
||||||
|
DEBUG_TIME_BEGIN();
|
||||||
|
|
||||||
ctx->running = EINA_TRUE;
|
ctx->running = EINA_TRUE;
|
||||||
EINA_INLIST_FOREACH(ctx->commands, cmd)
|
EINA_INLIST_FOREACH(ctx->commands, cmd)
|
||||||
{
|
{
|
||||||
|
@ -1809,6 +1811,7 @@ _filter_chain_run(Evas_Filter_Context *ctx)
|
||||||
|
|
||||||
end:
|
end:
|
||||||
ctx->running = EINA_FALSE;
|
ctx->running = EINA_FALSE;
|
||||||
|
DEBUG_TIME_END();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,15 +4,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.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
|
#if DIV_USING_BITSHIFT
|
||||||
static int
|
static int
|
||||||
_smallest_pow2_larger_than(int val)
|
_smallest_pow2_larger_than(int val)
|
||||||
|
@ -39,20 +30,6 @@ _smallest_pow2_larger_than(int val)
|
||||||
# define DIVIDE_BY_DIAMETER(val) ((val) / diameter)
|
# define DIVIDE_BY_DIAMETER(val) ((val) / diameter)
|
||||||
#endif
|
#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 */
|
/* RGBA functions */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -29,6 +29,15 @@
|
||||||
#define GREEN_OF(a) (((a) >> 8) & 0xff)
|
#define GREEN_OF(a) (((a) >> 8) & 0xff)
|
||||||
#define BLUE_OF(a) ((a) & 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
|
// The 'restrict' keyword is part of C99
|
||||||
#if __STDC_VERSION__ < 199901L
|
#if __STDC_VERSION__ < 199901L
|
||||||
# define restrict
|
# 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_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)
|
#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;
|
typedef enum _Evas_Filter_Interpolation_Mode Evas_Filter_Interpolation_Mode;
|
||||||
|
|
||||||
struct _Evas_Filter_Context
|
struct _Evas_Filter_Context
|
||||||
|
|
Loading…
Reference in New Issue