X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fprofile.c;h=91753e0f00bf5617f2ca75276b2ba6fe6ada56bd;hb=166ba1350d802535b6a6ea7ea0bc29c56a71b7ec;hp=648026f01053a6e457bc91c1fb825ff91989d7e5;hpb=ea1ea793fe6e244ef5555ed983423a204101af13;p=chise%2Fxemacs-chise.git.1 diff --git a/src/profile.c b/src/profile.c index 648026f..91753e0 100644 --- a/src/profile.c +++ b/src/profile.c @@ -30,6 +30,10 @@ Boston, MA 02111-1307, USA. */ #include "syssignal.h" #include "systime.h" +#ifndef HAVE_SETITIMER +#error Sorry charlie. We need a scalpel and all we have is a lawnmower. +#endif + /* We implement our own profiling scheme so that we can determine things like which Lisp functions are occupying the most time. Any standard OS-provided profiling works on C functions, which is @@ -60,7 +64,7 @@ Boston, MA 02111-1307, USA. */ static struct hash_table *big_profile_table; Lisp_Object Vcall_count_profile_table; -int default_profiling_interval; +Fixnum default_profiling_interval; int profiling_active; @@ -119,9 +123,10 @@ sigprof_handler (int signo) { fun = *backtrace_list->function; - if (!SYMBOLP (fun) && - !COMPILED_FUNCTIONP (fun) && - !SUBRP (fun)) + if (!SYMBOLP (fun) + && !COMPILED_FUNCTIONP (fun) + && !SUBRP (fun) + && !CONSP (fun)) fun = QSunknown; } else @@ -134,14 +139,14 @@ sigprof_handler (int signo) lose because of this. Even worse, if the memory allocation fails, the `error' generated whacks everything hard. */ long count; - CONST void *vval; + const void *vval; if (gethash (LISP_TO_VOID (fun), big_profile_table, &vval)) count = (long) vval; else count = 0; count++; - vval = (CONST void *) count; + vval = (const void *) count; puthash (LISP_TO_VOID (fun), (void *) vval, big_profile_table); } @@ -191,7 +196,7 @@ will be properly accumulated. foo.it_interval = foo.it_value; profiling_active = 1; inside_profiling = 0; - setitimer (ITIMER_PROF, &foo, 0); + qxe_setitimer (ITIMER_PROF, &foo, 0); return Qnil; } @@ -206,7 +211,7 @@ Stop profiling. foo.it_value.tv_sec = 0; foo.it_value.tv_usec = 0; foo.it_interval = foo.it_value; - setitimer (ITIMER_PROF, &foo, 0); + qxe_setitimer (ITIMER_PROF, &foo, 0); profiling_active = 0; signal (SIGPROF, fatal_error_signal); return Qnil; @@ -225,7 +230,7 @@ struct get_profiling_info_closure }; static int -get_profiling_info_maphash (CONST void *void_key, +get_profiling_info_maphash (const void *void_key, void *void_val, void *void_closure) { @@ -263,7 +268,7 @@ Return the profiling info as an alist. } static int -mark_profiling_info_maphash (CONST void *void_key, +mark_profiling_info_maphash (const void *void_key, void *void_val, void *void_closure) {