summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-11-06 11:06:21 -0800
committerCedric BAIL <cedric@osg.samsung.com>2017-11-07 16:08:39 -0800
commit3d72cb8da38d014a75a2e2908ee37b33676f38b5 (patch)
treef20e47342c8ff0d5bc566f747ab9294a72de7bdf
parentdd40079185577c5330f72817e0385aa9cda2e7f4 (diff)
downloadefl-3d72cb8da38d014a75a2e2908ee37b33676f38b5.tar.gz
ecore: report startup time of the main loop with EFL_FIRST_LOOP environment variable.
-rw-r--r--src/lib/ecore/ecore.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index 00bf640624..5ac30d64b2 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -202,6 +202,25 @@ ecore_system_modules_unload(void)
}
}
+static void
+_efl_first_loop_iterate(void *data, const Efl_Event *event)
+{
+ double end = ecore_time_unix_get();
+ char *first = data;
+
+ switch (*first)
+ {
+ case 'A': abort();
+ case 'E':
+ case 'D': exit(-1);
+ case 'T': fprintf(stderr, "Loop started: '%f' - '%f' = '%f' sec\n", end, _efl_startup_time, end - _efl_startup_time);
+ break;
+ }
+
+ efl_event_callback_del(event->object, EFL_LOOP_EVENT_RESUME,
+ _efl_first_loop_iterate, data);
+}
+
EAPI void
ecore_app_no_system_modules(void)
{
@@ -326,6 +345,12 @@ ecore_init(void)
if (!_no_system_modules)
ecore_system_modules_load();
+ if (getenv("EFL_FIRST_LOOP"))
+ efl_event_callback_add(ecore_main_loop_get(),
+ EFL_LOOP_EVENT_RESUME,
+ _efl_first_loop_iterate,
+ getenv("EFL_FIRST_LOOP"));
+
_ecore_init_count_threshold = _ecore_init_count;
eina_log_timing(_ecore_log_dom,