diff options
| author | Stefan Monnier | 2012-09-24 17:15:53 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-09-24 17:15:53 -0400 |
| commit | ad942b63d7a9b984752f46bc2049fe10e488230d (patch) | |
| tree | 71e47ecb9d1e00b996a7e291fef9d4dda1f82386 /src | |
| parent | 3d80c99f3817bf5eccd6acc6a79498a4fde979a4 (diff) | |
| download | emacs-ad942b63d7a9b984752f46bc2049fe10e488230d.tar.gz emacs-ad942b63d7a9b984752f46bc2049fe10e488230d.zip | |
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.
Diffstat (limited to 'src')
| -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 |
4 files changed, 27 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1b90ae8b976..19b8afe5d51 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | 2012-09-24 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2012-09-24 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * profiler.c (evict_lower_half): Fix typo. | ||
| 4 | (PROFILER_CPU_SUPPORT): Check and define if cpu-profiler is supported. | ||
| 5 | Don't compile the cpu-profiler code, if not supported. | ||
| 6 | (malloc_probe): Presume memory_log is non-nil. | ||
| 7 | (syms_of_profiler): Don't defsubr functions when they aren't defined. | ||
| 8 | |||
| 9 | * lisp.h (sample_profiler_running, gc_probe): Don't declare. | ||
| 10 | |||
| 11 | 2012-09-24 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 12 | |||
| 3 | * xdisp.c (Qautomatic_redisplay): New constant. | 13 | * xdisp.c (Qautomatic_redisplay): New constant. |
| 4 | (redisplay_internal): Record itself in backtrace_list. | 14 | (redisplay_internal): Record itself in backtrace_list. |
| 5 | (syms_of_xdisp): Define Qautomatic_redisplay. | 15 | (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); | |||
| 3525 | void syms_of_dbusbind (void); | 3525 | void syms_of_dbusbind (void); |
| 3526 | #endif | 3526 | #endif |
| 3527 | 3527 | ||
| 3528 | /* Defined in profiler.c */ | 3528 | |
| 3529 | extern bool sample_profiler_running; | 3529 | /* Defined in profiler.c. */ |
| 3530 | extern bool memory_profiler_running; | 3530 | extern bool memory_profiler_running; |
| 3531 | extern void malloc_probe (size_t); | 3531 | extern void malloc_probe (size_t); |
| 3532 | extern void gc_probe (size_t, size_t); | ||
| 3533 | #define MALLOC_PROBE(size) \ | 3532 | #define MALLOC_PROBE(size) \ |
| 3534 | do { \ | 3533 | do { \ |
| 3535 | if (memory_profiler_running) \ | 3534 | if (memory_profiler_running) \ |
| 3536 | malloc_probe (size); \ | 3535 | malloc_probe (size); \ |
| 3537 | } while (0) | 3536 | } while (0) |
| 3538 | |||
| 3539 | extern void syms_of_profiler (void); | 3537 | extern void syms_of_profiler (void); |
| 3540 | 3538 | ||
| 3539 | |||
| 3541 | #ifdef DOS_NT | 3540 | #ifdef DOS_NT |
| 3542 | /* Defined in msdos.c, w32.c */ | 3541 | /* Defined in msdos.c, w32.c */ |
| 3543 | extern char *emacs_root_dir (void); | 3542 | 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) | |||
| 126 | int j; | 126 | int j; |
| 127 | eassert (VECTORP (key)); | 127 | eassert (VECTORP (key)); |
| 128 | for (j = 0; j < ASIZE (key); j++) | 128 | for (j = 0; j < ASIZE (key); j++) |
| 129 | ASET (key, i, Qnil); | 129 | ASET (key, j, Qnil); |
| 130 | } | 130 | } |
| 131 | set_hash_key_slot (log, i, key); | 131 | set_hash_key_slot (log, i, key); |
| 132 | } | 132 | } |
| @@ -190,6 +190,9 @@ record_backtrace (log_t *log, size_t count) | |||
| 190 | 190 | ||
| 191 | /* Sample profiler. */ | 191 | /* Sample profiler. */ |
| 192 | 192 | ||
| 193 | #if defined SIGPROF && defined HAVE_SETITIMER | ||
| 194 | #define PROFILER_CPU_SUPPORT | ||
| 195 | |||
| 193 | static Lisp_Object cpu_log; | 196 | static Lisp_Object cpu_log; |
| 194 | /* Separate counter for the time spent in the GC. */ | 197 | /* Separate counter for the time spent in the GC. */ |
| 195 | static EMACS_INT cpu_gc_count; | 198 | static EMACS_INT cpu_gc_count; |
| @@ -279,7 +282,7 @@ log is collected and SLOTS is a list of slots. */) | |||
| 279 | cpu_gc_count = 0; | 282 | cpu_gc_count = 0; |
| 280 | return result; | 283 | return result; |
| 281 | } | 284 | } |
| 282 | 285 | #endif | |
| 283 | 286 | ||
| 284 | /* Memory profiler. */ | 287 | /* Memory profiler. */ |
| 285 | 288 | ||
| @@ -365,12 +368,11 @@ sigprof_handler (int signal, siginfo_t *info, void *ctx) | |||
| 365 | } | 368 | } |
| 366 | 369 | ||
| 367 | /* Record that the current backtrace allocated SIZE bytes. */ | 370 | /* Record that the current backtrace allocated SIZE bytes. */ |
| 368 | /* FIXME: Inline it everywhere! */ | ||
| 369 | void | 371 | void |
| 370 | malloc_probe (size_t size) | 372 | malloc_probe (size_t size) |
| 371 | { | 373 | { |
| 372 | if (HASH_TABLE_P (memory_log)) | 374 | eassert (HASH_TABLE_P (memory_log)); |
| 373 | record_backtrace (XHASH_TABLE (memory_log), size); | 375 | record_backtrace (XHASH_TABLE (memory_log), size); |
| 374 | } | 376 | } |
| 375 | 377 | ||
| 376 | void | 378 | void |
| @@ -383,17 +385,18 @@ syms_of_profiler (void) | |||
| 383 | doc: /* FIXME */); | 385 | doc: /* FIXME */); |
| 384 | profiler_slot_heap_size = 10000; | 386 | profiler_slot_heap_size = 10000; |
| 385 | 387 | ||
| 386 | cpu_log = memory_log = Qnil; | ||
| 387 | staticpro (&cpu_log); | ||
| 388 | staticpro (&memory_log); | ||
| 389 | |||
| 390 | /* FIXME: Rename things to start with "profiler-", to use "cpu" instead of | 388 | /* FIXME: Rename things to start with "profiler-", to use "cpu" instead of |
| 391 | "sample", and to make them sound like they're internal or something. */ | 389 | "sample", and to make them sound like they're internal or something. */ |
| 390 | #ifdef PROFILER_CPU_SUPPORT | ||
| 391 | cpu_log = Qnil; | ||
| 392 | staticpro (&cpu_log); | ||
| 392 | defsubr (&Ssample_profiler_start); | 393 | defsubr (&Ssample_profiler_start); |
| 393 | defsubr (&Ssample_profiler_stop); | 394 | defsubr (&Ssample_profiler_stop); |
| 394 | defsubr (&Ssample_profiler_running_p); | 395 | defsubr (&Ssample_profiler_running_p); |
| 395 | defsubr (&Ssample_profiler_log); | 396 | defsubr (&Ssample_profiler_log); |
| 396 | 397 | #endif | |
| 398 | memory_log = Qnil; | ||
| 399 | staticpro (&memory_log); | ||
| 397 | defsubr (&Smemory_profiler_start); | 400 | defsubr (&Smemory_profiler_start); |
| 398 | defsubr (&Smemory_profiler_stop); | 401 | defsubr (&Smemory_profiler_stop); |
| 399 | defsubr (&Smemory_profiler_running_p); | 402 | 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) | |||
| 29376 | the following three functions in w32fns.c. */ | 29376 | the following three functions in w32fns.c. */ |
| 29377 | #ifndef WINDOWSNT | 29377 | #ifndef WINDOWSNT |
| 29378 | 29378 | ||
| 29379 | /* Platform-independent portion of hourglass implementation. */ | 29379 | /* Platform-independent portion of hourglass implementation. */ |
| 29380 | 29380 | ||
| 29381 | /* Cancel a currently active hourglass timer, and start a new one. */ | 29381 | /* Cancel a currently active hourglass timer, and start a new one. */ |
| 29382 | void | 29382 | void |