emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109169: Extend the value returned by


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109169: Extend the value returned by Fgarbage_collect with heap statistics.
Date: Fri, 20 Jul 2012 18:07:28 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109169
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-07-20 18:07:28 +0400
message:
  Extend the value returned by Fgarbage_collect with heap statistics.
  * alloc.c (Qheap): New symbol.
  (syms_of_alloc): DEFSYM it.
  (Fgarbage_collect): If DOUG_LEA_MALLOC, add mallinfo data.
  (Fmemory_free): Remove.
  (syms_of_alloc): Don't defsubr it.
  * buffer.c (Fcompact_buffer): Remove.
  (syms_of_buffer): Don't defsubr it.
modified:
  src/ChangeLog
  src/alloc.c
  src/buffer.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-20 13:14:58 +0000
+++ b/src/ChangeLog     2012-07-20 14:07:28 +0000
@@ -1,5 +1,16 @@
 2012-07-20  Dmitry Antipov  <address@hidden>
 
+       Extend the value returned by Fgarbage_collect with heap statistics.
+       * alloc.c (Qheap): New symbol.
+       (syms_of_alloc): DEFSYM it.
+       (Fgarbage_collect): If DOUG_LEA_MALLOC, add mallinfo data.
+       (Fmemory_free): Remove.
+       (syms_of_alloc): Don't defsubr it.
+       * buffer.c (Fcompact_buffer): Remove.
+       (syms_of_buffer): Don't defsubr it.
+
+2012-07-20  Dmitry Antipov  <address@hidden>
+
        Make maybe_gc inline.
        Verify that inlining is always possible (GCC 4.7.1, -O3 -Winline).
        * lisp.h (consing_since_gc, gc_relative_threshold)

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-20 13:14:58 +0000
+++ b/src/alloc.c       2012-07-20 14:07:28 +0000
@@ -258,7 +258,7 @@
 static ptrdiff_t stack_copy_size;
 #endif
 
-static Lisp_Object Qstring_bytes, Qvector_slots;
+static Lisp_Object Qstring_bytes, Qvector_slots, Qheap;
 static Lisp_Object Qgc_cons_threshold;
 Lisp_Object Qchar_table_extra_slots;
 
@@ -5396,7 +5396,7 @@
   char stack_top_variable;
   ptrdiff_t i;
   int message_p;
-  Lisp_Object total[10];
+  Lisp_Object total[11];
   ptrdiff_t count = SPECPDL_INDEX ();
   EMACS_TIME t1;
 
@@ -5655,6 +5655,15 @@
   total[9] = list3 (Qbuffer, make_number (sizeof (struct buffer)),
                    bounded_number (total_buffers));
 
+  total[10] = list4 (Qheap, make_number (1024),
+#ifdef DOUG_LEA_MALLOC
+                    bounded_number ((mallinfo ().uordblks + 1023) >> 10),
+                    bounded_number ((mallinfo ().fordblks + 1023) >> 10)
+#else
+                    Qnil, Qnil
+#endif
+                    );
+
 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
   {
     /* Compute average percentage of zombies.  */
@@ -6602,33 +6611,6 @@
   return end;
 }
 
-DEFUN ("memory-free", Fmemory_free, Smemory_free, 0, 0, 0,
-       doc: /* Return a list (E H) of two measures of free memory.
-E counts free lists maintained by Emacs itself.  H counts the heap,
-freed by Emacs but not released to the operating system; this is zero
-if heap statistics are not available.  Both counters are in units of
-1024 bytes, rounded up.  */)
-     (void)
-{
-  /* Make the return value first, so that its storage is accounted for.  */
-  Lisp_Object val = Fmake_list (make_number (2), make_number (0));
-
-  XSETCAR (val,
-          bounded_number
-          ((total_free_conses * sizeof (struct Lisp_Cons)
-            + total_free_markers * sizeof (union Lisp_Misc)
-            + total_free_symbols * sizeof (struct Lisp_Symbol)
-            + total_free_floats * sizeof (struct Lisp_Float)
-            + total_free_intervals * sizeof (struct interval)
-            + total_free_strings * sizeof (struct Lisp_String)
-            + total_free_vector_slots * word_size
-            + 1023) >> 10));
-#ifdef DOUG_LEA_MALLOC
-  XSETCAR (XCDR (val), bounded_number ((mallinfo ().fordblks + 1023) >> 10));
-#endif
-  return val;
-}
-
 DEFUN ("memory-use-counts", Fmemory_use_counts, Smemory_use_counts, 0, 0, 0,
        doc: /* Return a list of counters that measure how much consing there 
has been.
 Each of these counters increments for a certain kind of object.
@@ -6845,6 +6827,7 @@
 
   DEFSYM (Qstring_bytes, "string-bytes");
   DEFSYM (Qvector_slots, "vector-slots");
+  DEFSYM (Qheap, "heap");
 
   DEFSYM (Qgc_cons_threshold, "gc-cons-threshold");
   DEFSYM (Qchar_table_extra_slots, "char-table-extra-slots");
@@ -6868,7 +6851,6 @@
   defsubr (&Spurecopy);
   defsubr (&Sgarbage_collect);
   defsubr (&Smemory_limit);
-  defsubr (&Smemory_free);
   defsubr (&Smemory_use_counts);
 
 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-07-19 22:35:58 +0000
+++ b/src/buffer.c      2012-07-20 14:07:28 +0000
@@ -1474,19 +1474,6 @@
   return 0;
 }
 
-DEFUN ("compact-buffer", Fcompact_buffer, Scompact_buffer, 0, 1, 0,
-       doc: /* Compact BUFFER by truncating undo list and shrinking the gap.
-If buffer is nil, compact current buffer.  Compaction is performed
-only if buffer was changed since last compaction.  Return t if
-buffer compaction was performed, and nil otherwise.  */)
-  (Lisp_Object buffer)
-{
-  if (NILP (buffer))
-    XSETBUFFER (buffer, current_buffer);
-  CHECK_BUFFER (buffer);
-  return compact_buffer (XBUFFER (buffer)) ? Qt : Qnil;
-}
-
 DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
        doc: /* Kill the buffer specified by BUFFER-OR-NAME.
 The argument may be a buffer or the name of an existing buffer.
@@ -6048,7 +6035,6 @@
   defsubr (&Srename_buffer);
   defsubr (&Sother_buffer);
   defsubr (&Sbuffer_enable_undo);
-  defsubr (&Scompact_buffer);
   defsubr (&Skill_buffer);
   defsubr (&Sbury_buffer_internal);
   defsubr (&Sset_buffer_major_mode);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]