make it possible to follow output tick.

This commit is contained in:
Cedric BAIL 2017-06-13 14:33:56 -07:00
parent e7b11dd328
commit fe8e23cbc6
3 changed files with 28 additions and 4 deletions

View File

@ -1135,6 +1135,7 @@ static const Ecore_Getopt optdesc = {
ECORE_GETOPT_STORE_TRUE('m', "compat", "Output compatible with expedite-cmp"), ECORE_GETOPT_STORE_TRUE('m', "compat", "Output compatible with expedite-cmp"),
ECORE_GETOPT_STORE_TRUE('y', "async", "Enable async output"), ECORE_GETOPT_STORE_TRUE('y', "async", "Enable async output"),
ECORE_GETOPT_STORE_TRUE('a', "all", "Run all tests"), ECORE_GETOPT_STORE_TRUE('a', "all", "Run all tests"),
ECORE_GETOPT_STORE_FALSE('i', "tick", "Follow output animator tick"),
ECORE_GETOPT_LICENSE('L', "license"), ECORE_GETOPT_LICENSE('L', "license"),
ECORE_GETOPT_COPYRIGHT('C', "copyright"), ECORE_GETOPT_COPYRIGHT('C', "copyright"),
ECORE_GETOPT_VERSION('V', "version"), ECORE_GETOPT_VERSION('V', "version"),
@ -1171,6 +1172,8 @@ static const Expedite_Resolution resolutions[] = {
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };
Eina_Bool tick = EINA_TRUE;
static void static void
_cb_delete(Ecore_Evas *ee EINA_UNUSED) _cb_delete(Ecore_Evas *ee EINA_UNUSED)
{ {
@ -1180,6 +1183,22 @@ _cb_delete(Ecore_Evas *ee EINA_UNUSED)
static Eina_Bool static Eina_Bool
_cb_anim(void *data EINA_UNUSED) _cb_anim(void *data EINA_UNUSED)
{ {
static double last = 0;
static double avg = 0;
static unsigned long long count = 0;
double current;
current = ecore_loop_time_get();
if (count++)
{
avg += current - last;
if (abs(current - last - (avg / (count - 1))) > 0.05)
fprintf(stderr, "delta: %f vs %f (%f)\n",
current - last,
avg / (count - 1));
}
last = current;
ui_loop(NULL); ui_loop(NULL);
return EINA_TRUE; return EINA_TRUE;
} }
@ -1230,6 +1249,7 @@ main(int argc, char **argv)
ECORE_GETOPT_VALUE_BOOL(cmp_report), ECORE_GETOPT_VALUE_BOOL(cmp_report),
ECORE_GETOPT_VALUE_BOOL(async), ECORE_GETOPT_VALUE_BOOL(async),
ECORE_GETOPT_VALUE_BOOL(all_tests), ECORE_GETOPT_VALUE_BOOL(all_tests),
ECORE_GETOPT_VALUE_BOOL(tick),
ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option),
ECORE_GETOPT_VALUE_BOOL(quit_option), ECORE_GETOPT_VALUE_BOOL(quit_option),
@ -1351,7 +1371,7 @@ main(int argc, char **argv)
choosen_engine = ecore_evas_engine_name_get(ee); choosen_engine = ecore_evas_engine_name_get(ee);
ecore_evas_callback_delete_request_set(ee, _cb_delete); ecore_evas_callback_delete_request_set(ee, _cb_delete);
ecore_evas_callback_post_render_set(ee, _cb_post_render); if (tick) ecore_evas_callback_post_render_set(ee, _cb_post_render);
evas = ecore_evas_get(ee); evas = ecore_evas_get(ee);
@ -1390,7 +1410,7 @@ main(int argc, char **argv)
if (all_tests) ui_all(); if (all_tests) ui_all();
anim = ecore_animator_add(_cb_anim, ee); anim = ecore_animator_add(_cb_anim, ee);
ecore_animator_custom_tick(); if (tick) ecore_animator_custom_tick();
ecore_main_loop_begin(); ecore_main_loop_begin();
ecore_animator_del(anim); ecore_animator_del(anim);

View File

@ -52,6 +52,7 @@ extern const char *choosen_engine;
extern Eina_Bool fullscreen; extern Eina_Bool fullscreen;
extern Eina_Bool cmp_report; extern Eina_Bool cmp_report;
extern char *output; extern char *output;
extern Eina_Bool tick;
typedef struct _Expedite_Resolution Expedite_Resolution; typedef struct _Expedite_Resolution Expedite_Resolution;
typedef struct _Expedite_Engine Expedite_Engine; typedef struct _Expedite_Engine Expedite_Engine;

View File

@ -664,8 +664,11 @@ ui_func_set(void (*kfunc) (const char *key), void (*lfunc) (double t, int f))
f_loop = f_start = 0; f_loop = f_start = 0;
ui_fps(0.0); ui_fps(0.0);
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); if (tick)
ecore_animator_custom_tick(); {
ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
ecore_animator_custom_tick();
}
} }
void void