]> git.eshelyaron.com Git - emacs.git/commitdiff
Try to let it compile on other platforms
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 24 Sep 2012 21:15:53 +0000 (17:15 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 24 Sep 2012 21:15:53 +0000 (17:15 -0400)
* 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.

lisp/profiler.el
src/ChangeLog
src/lisp.h
src/profiler.c
src/xdisp.c

index 00ee99a61324cede442763f17146737ad0e8e75b..90740a2e286e1ae6379d9df7f2a671d7197a80ee 100644 (file)
@@ -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)
index 1b90ae8b9762901073a24544bb412f8ea5977e22..19b8afe5d51fd89fb78454b817689758b7e5e278 100644 (file)
@@ -1,3 +1,13 @@
+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.
index 09a812829a3f2bf0a3e96e6ad3936ecc9b3eeb57..f029a061d24f607ab16b292874654b70bc692b45 100644 (file)
@@ -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);
index 5eaaaf3330fb6b747b84142546d7d4fbbb9d69c0..d22ab14e7cec0f63569e6756455480d9c62ac104 100644 (file)
@@ -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)
 \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;
@@ -279,7 +282,7 @@ log is collected and SLOTS is a list of slots.  */)
   cpu_gc_count = 0;
   return result;
 }
-
+#endif
 \f
 /* 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);
index ccfa251fd1cebfd5552b5751c829f82384d18b3e..3bb2dacb5316eeacfed6cda95d1665003a745f84 100644 (file)
@@ -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