discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=98f1a9f036a6413a984aec0970f04be1174f97aa

commit 98f1a9f036a6413a984aec0970f04be1174f97aa
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Thu Aug 1 09:22:55 2013 +0100

    feature: E_FIRST_FRAME env variable
    
    requested by cedric for profiling, works just like similar elm variable
---
 src/bin/e.h             |  3 +++
 src/bin/e_comp_canvas.c | 21 +++++++++++++++++++++
 src/bin/e_main.c        |  9 ++++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/bin/e.h b/src/bin/e.h
index 95d0d8a..82ee244 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 87b5915..997af7e 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 5d5b6db..77026eb 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())
      {

-- 


Reply via email to