Commit ad942b63 authored by Stefan Monnier's avatar Stefan Monnier

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.
parent 3d80c99f
......@@ -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)
......
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.
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment