From bf4e2fcae99b3af87447cab152f47e148e679857 Mon Sep 17 00:00:00 2001 From: cedric Date: Thu, 19 May 2011 15:38:30 +0000 Subject: [PATCH] ecore: improve ecore_timer_dump. Now E17 msgbus module will provide an usefull way to list all the running timer and see if we are not waking up to often. Use d-feet to see that information. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@59542 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore/ecore_timer.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c index d8d57d3..b6ab05c 100644 --- a/src/lib/ecore/ecore_timer.c +++ b/src/lib/ecore/ecore_timer.c @@ -175,6 +175,12 @@ ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data) if (!timer) return NULL; ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER); now = ecore_loop_time_get(); + +#ifdef WANT_ECORE_TIMER_DUMP + timer->timer_bt_num = backtrace((void**) (timer->timer_bt), + ECORE_TIMER_DEBUG_BT_NUM); +#endif + _ecore_timer_set(timer, now + in, in, func, (void *)data); return timer; } @@ -368,6 +374,8 @@ ecore_timer_dump(void) char *out; Ecore_Timer *tm; Eina_List *tmp = NULL; + int living_timer = 0; + int unknow_timer = 0; result = eina_strbuf_new(); @@ -379,9 +387,15 @@ ecore_timer_dump(void) char **strings; int j; + if (!tm->frozen && !tm->delete_me) + living_timer++; + strings = backtrace_symbols((void**) tm->timer_bt, tm->timer_bt_num); - if (strings == NULL) - continue ; + if (tm->timer_bt_num <= 0 || strings == NULL) + { + unknow_timer++; + continue ; + } eina_strbuf_append_printf(result, "*** timer: %f ***\n", tm->in); if (tm->frozen) @@ -394,6 +408,8 @@ ecore_timer_dump(void) free(strings); } + eina_strbuf_append_printf(result, "\n***\nThere is %i living timer.\nWe did lost track of %i timers.\n", living_timer, unknow_timer); + out = eina_strbuf_string_steal(result); eina_strbuf_free(result); @@ -669,5 +685,5 @@ _ecore_timer_cmp(const void *d1, const void *d2) const Ecore_Timer *t1 = d1; const Ecore_Timer *t2 = d2; - return (int) t1->in - t2->in; + return (int) ((t1->in - t2->in) * 100); } -- 2.7.4