ecore: improve ecore_timer_dump.
authorCedric BAIL <cedric.bail@free.fr>
Wed, 18 May 2011 09:12:07 +0000 (09:12 +0000)
committerCedric BAIL <cedric.bail@free.fr>
Wed, 18 May 2011 09:12:07 +0000 (09:12 +0000)
SVN revision: 59491

legacy/ecore/configure.ac
legacy/ecore/src/lib/ecore/ecore_timer.c

index 07fa7cb66705beb1ccd73bcd0f535a4dbda02662..4f7c15e5678447b7e7d8afe6e81e010fe597789e 100644 (file)
@@ -345,13 +345,16 @@ fi
 AC_SUBST(pkgconfig_requires_private)
 
 ### Checks for some build time option
+have_backtrace="no"
+AC_CHECK_FUNCS([backtrace], [have_backtrace="yes"], [])
+
 want_ecore_timer_dump="yes"
 
 AC_ARG_ENABLE([ecore-timer-dump],
    [AC_HELP_STRING([--disable-ecore-timer-dump], [disable tracking of timer allocation. @<:@default=enable@:>@])],
    [want_ecore_timer_dump=$enableval], [])
 
-if test "x$want_ecore_timer_dump" = "xyes"; then
+if test "x$want_ecore_timer_dump" = "xyes" -a "x$have_backtrace" = "xyes"; then
    AC_DEFINE(WANT_ECORE_TIMER_DUMP, [1], [Want Ecore_Timer dump infrastructure])
 fi
 
index dadcf405ed11c567756e08db1673bac3f2bc87bb..d8d57d3a75db2c30626996a1026bf64c5a39c324 100644 (file)
@@ -377,11 +377,9 @@ ecore_timer_dump(void)
    EINA_LIST_FREE(tmp, tm)
      {
         char **strings;
-        int nptrs;
         int j;
 
-        nptrs = backtrace((void**) tm->timer_bt, ECORE_TIMER_DEBUG_BT_NUM);
-        strings = backtrace_symbols((void**) tm->timer_bt, nptrs);
+        strings = backtrace_symbols((void**) tm->timer_bt, tm->timer_bt_num);
         if (strings == NULL)
           continue ;
 
@@ -390,7 +388,7 @@ ecore_timer_dump(void)
           eina_strbuf_append(result, "FROZEN\n");
         if (tm->delete_me)
           eina_strbuf_append(result, "DELETED\n");
-        for (j = 0; j < nptrs; j++)
+        for (j = 0; j < tm->timer_bt_num; j++)
           eina_strbuf_append_printf(result, "%s\n", strings[j]);
 
         free(strings);