* 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.
;;; Commentary:
-;;
+;;
;;; Code:
(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.
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);
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);
}
\f
/* 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;
cpu_gc_count = 0;
return result;
}
-
+#endif
\f
/* Memory profiler. */
}
/* 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
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);
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