diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-09-24 17:15:53 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-09-24 17:15:53 -0400 |
commit | ad942b63d7a9b984752f46bc2049fe10e488230d (patch) | |
tree | 71e47ecb9d1e00b996a7e291fef9d4dda1f82386 | |
parent | 3d80c99f3817bf5eccd6acc6a79498a4fde979a4 (diff) | |
download | emacs-ad942b63d7a9b984752f46bc2049fe10e488230d.tar.gz |
Try to let it compile on other platforms
* src/profiler.c (evict_lower_half): Fix typo.
(PROFILER_CPU_SUPPORT): Check and define if cpu-profiler is supported.
Don't compile the cpu-profiler code, if not supported.
(malloc_probe): Presume memory_log is non-nil.
(syms_of_profiler): Don't defsubr functions when they aren't defined.
* src/lisp.h (sample_profiler_running, gc_probe): Don't declare.
-rw-r--r-- | lisp/profiler.el | 3 | ||||
-rw-r--r-- | src/ChangeLog | 10 | ||||
-rw-r--r-- | src/lisp.h | 7 | ||||
-rw-r--r-- | src/profiler.c | 23 | ||||
-rw-r--r-- | src/xdisp.c | 2 |
5 files changed, 29 insertions, 16 deletions
diff --git a/lisp/profiler.el b/lisp/profiler.el index 00ee99a6132..90740a2e286 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -20,7 +20,7 @@ ;;; Commentary: -;; +;; ;;; Code: @@ -237,6 +237,7 @@ be same type." (defun profiler-calltree-compute-percentages (tree) (let ((total-count 0)) + ;; FIXME: the memory profiler's total wraps around all too easily! (dolist (child (profiler-calltree-children tree)) (cl-incf total-count (profiler-calltree-count child))) (unless (zerop total-count) diff --git a/src/ChangeLog b/src/ChangeLog index 1b90ae8b976..19b8afe5d51 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,15 @@ 2012-09-24 Stefan Monnier <monnier@iro.umontreal.ca> + * profiler.c (evict_lower_half): Fix typo. + (PROFILER_CPU_SUPPORT): Check and define if cpu-profiler is supported. + Don't compile the cpu-profiler code, if not supported. + (malloc_probe): Presume memory_log is non-nil. + (syms_of_profiler): Don't defsubr functions when they aren't defined. + + * lisp.h (sample_profiler_running, gc_probe): Don't declare. + +2012-09-24 Stefan Monnier <monnier@iro.umontreal.ca> + * xdisp.c (Qautomatic_redisplay): New constant. (redisplay_internal): Record itself in backtrace_list. (syms_of_xdisp): Define Qautomatic_redisplay. diff --git a/src/lisp.h b/src/lisp.h index 09a812829a3..f029a061d24 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3525,19 +3525,18 @@ extern int have_menus_p (void); void syms_of_dbusbind (void); #endif -/* Defined in profiler.c */ -extern bool sample_profiler_running; + +/* Defined in profiler.c. */ extern bool memory_profiler_running; extern void malloc_probe (size_t); -extern void gc_probe (size_t, size_t); #define MALLOC_PROBE(size) \ do { \ if (memory_profiler_running) \ malloc_probe (size); \ } while (0) - extern void syms_of_profiler (void); + #ifdef DOS_NT /* Defined in msdos.c, w32.c */ extern char *emacs_root_dir (void); diff --git a/src/profiler.c b/src/profiler.c index 5eaaaf3330f..d22ab14e7ce 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -126,7 +126,7 @@ static void evict_lower_half (log_t *log) int j; eassert (VECTORP (key)); for (j = 0; j < ASIZE (key); j++) - ASET (key, i, Qnil); + ASET (key, j, Qnil); } set_hash_key_slot (log, i, key); } @@ -190,6 +190,9 @@ record_backtrace (log_t *log, size_t count) /* Sample profiler. */ +#if defined SIGPROF && defined HAVE_SETITIMER +#define PROFILER_CPU_SUPPORT + static Lisp_Object cpu_log; /* Separate counter for the time spent in the GC. */ static EMACS_INT cpu_gc_count; @@ -279,7 +282,7 @@ log is collected and SLOTS is a list of slots. */) cpu_gc_count = 0; return result; } - +#endif /* Memory profiler. */ @@ -365,12 +368,11 @@ sigprof_handler (int signal, siginfo_t *info, void *ctx) } /* Record that the current backtrace allocated SIZE bytes. */ -/* FIXME: Inline it everywhere! */ void malloc_probe (size_t size) { - if (HASH_TABLE_P (memory_log)) - record_backtrace (XHASH_TABLE (memory_log), size); + eassert (HASH_TABLE_P (memory_log)); + record_backtrace (XHASH_TABLE (memory_log), size); } void @@ -383,17 +385,18 @@ syms_of_profiler (void) doc: /* FIXME */); profiler_slot_heap_size = 10000; - cpu_log = memory_log = Qnil; - staticpro (&cpu_log); - staticpro (&memory_log); - /* FIXME: Rename things to start with "profiler-", to use "cpu" instead of "sample", and to make them sound like they're internal or something. */ +#ifdef PROFILER_CPU_SUPPORT + cpu_log = Qnil; + staticpro (&cpu_log); defsubr (&Ssample_profiler_start); defsubr (&Ssample_profiler_stop); defsubr (&Ssample_profiler_running_p); defsubr (&Ssample_profiler_log); - +#endif + memory_log = Qnil; + staticpro (&memory_log); defsubr (&Smemory_profiler_start); defsubr (&Smemory_profiler_stop); defsubr (&Smemory_profiler_running_p); diff --git a/src/xdisp.c b/src/xdisp.c index ccfa251fd1c..3bb2dacb531 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -29376,7 +29376,7 @@ init_xdisp (void) the following three functions in w32fns.c. */ #ifndef WINDOWSNT -/* Platform-independent portion of hourglass implementation. */ +/* Platform-independent portion of hourglass implementation. */ /* Cancel a currently active hourglass timer, and start a new one. */ void |