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)
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)
202 } 202 }
203} 203}
204 204
205static void
206_efl_first_loop_iterate(void *data, const Efl_Event *event)
207{
208 double end = ecore_time_unix_get();
209 char *first = data;
210
211 switch (*first)
212 {
213 case 'A': abort();
214 case 'E':
215 case 'D': exit(-1);
216 case 'T': fprintf(stderr, "Loop started: '%f' - '%f' = '%f' sec\n", end, _efl_startup_time, end - _efl_startup_time);
217 break;
218 }
219
220 efl_event_callback_del(event->object, EFL_LOOP_EVENT_RESUME,
221 _efl_first_loop_iterate, data);
222}
223
205EAPI void 224EAPI void
206ecore_app_no_system_modules(void) 225ecore_app_no_system_modules(void)
207{ 226{
@@ -326,6 +345,12 @@ ecore_init(void)
326 if (!_no_system_modules) 345 if (!_no_system_modules)
327 ecore_system_modules_load(); 346 ecore_system_modules_load();
328 347
348 if (getenv("EFL_FIRST_LOOP"))
349 efl_event_callback_add(ecore_main_loop_get(),
350 EFL_LOOP_EVENT_RESUME,
351 _efl_first_loop_iterate,
352 getenv("EFL_FIRST_LOOP"));
353
329 _ecore_init_count_threshold = _ecore_init_count; 354 _ecore_init_count_threshold = _ecore_init_count;
330 355
331 eina_log_timing(_ecore_log_dom, 356 eina_log_timing(_ecore_log_dom,