diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2013-08-01 09:22:55 +0100 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2013-12-23 18:36:32 -0500 |
commit | 95522343df5479d637d4c0ccd42e92c1cf8367bb (patch) | |
tree | ce1e90123b75a6dbdf015780bb945f0c70847943 | |
parent | 29d792094f483ef5e6a636664593e7e94b423ca1 (diff) | |
download | enlightenment-95522343df5479d637d4c0ccd42e92c1cf8367bb.tar.gz |
feature: E_FIRST_FRAME env variable
requested by cedric for profiling, works just like similar elm variable
-rw-r--r-- | src/bin/e.h | 3 | ||||
-rw-r--r-- | src/bin/e_comp_canvas.c | 21 | ||||
-rw-r--r-- | src/bin/e_main.c | 9 |
3 files changed, 32 insertions, 1 deletions
diff --git a/src/bin/e.h b/src/bin/e.h index 95d0d8aa58..82ee24414a 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -308,6 +308,9 @@ extern EAPI Eina_Bool e_nopause; extern EAPI Eina_Bool e_precache_end; extern EAPI Eina_Bool x_fatal; +extern EINTERN const char *e_first_frame; +extern EINTERN double e_first_frame_start_time; + EAPI void e_alert_composite_win(Ecore_X_Window root, Ecore_X_Window win); //#define SMARTERR(args...) abort() diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c index 7ec7d5b5c6..b6571087d0 100644 --- a/src/bin/e_comp_canvas.c +++ b/src/bin/e_comp_canvas.c @@ -12,6 +12,24 @@ _e_comp_canvas_event_compositor_resize_free(void *data EINA_UNUSED, void *event) /////////////////////////////////// static void +_e_comp_canvas_cb_first_frame(void *data, Evas *e, void *event_info EINA_UNUSED) +{ + E_Comp *c = data; + double now = ecore_time_get(); + + switch (e_first_frame[0]) + { + case 'A': abort(); + case 'E': + case 'D': exit(-1); + case 'T': fprintf(stderr, "Startup time: '%f' - '%f' = '%f'\n", now, e_first_frame_start_time, now - e_first_frame_start_time); + break; + } + + evas_event_callback_del_full(e, EVAS_CALLBACK_RENDER_POST, _e_comp_canvas_cb_first_frame, c); +} + +static void _e_comp_canvas_render_post(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED) { E_Comp *c = data; @@ -85,6 +103,9 @@ e_comp_canvas_init(E_Comp *c) unsigned int layer; c->evas = ecore_evas_get(c->ee); + + if (e_first_frame) + evas_event_callback_add(c->evas, EVAS_CALLBACK_RENDER_POST, _e_comp_canvas_cb_first_frame, c); ecore_evas_data_set(c->ee, "comp", c); o = evas_object_rectangle_add(c->evas); c->bg_blank_object = o; diff --git a/src/bin/e_main.c b/src/bin/e_main.c index ab49a8c7e9..109c3958d3 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -111,6 +111,8 @@ EAPI Eina_Bool starting = EINA_TRUE; EAPI Eina_Bool stopping = EINA_FALSE; EAPI Eina_Bool restart = EINA_FALSE; EAPI Eina_Bool e_nopause = EINA_FALSE; +EINTERN const char *e_first_frame = NULL; +EINTERN double e_first_frame_start_time = -1; static void _xdg_data_dirs_augment(void) @@ -168,7 +170,6 @@ main(int argc, char **argv) #ifdef TS_DO t0 = t1 = t2 = ecore_time_unix_get(); #endif - TS("Begin Startup"); /* trap deadly bug signals and allow some form of sane recovery */ @@ -288,6 +289,12 @@ main(int argc, char **argv) TS("Ecore Init Done"); _e_main_shutdown_push(ecore_shutdown); + e_first_frame = getenv("E_FIRST_FRAME"); + if (e_first_frame && (!e_first_frame[0])) + e_first_frame = NULL; + else + e_first_frame_start_time = ecore_time_get(); + TS("EIO Init"); if (!eio_init()) { |