emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109261: Cleanup statistics calculati


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109261: Cleanup statistics calculation in Fgarbage_collect.
Date: Sun, 29 Jul 2012 17:51:45 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109261
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Sun 2012-07-29 17:51:45 +0400
message:
  Cleanup statistics calculation in Fgarbage_collect.
  * alloc.c (Fgarbage_collect): Rename t1 to meaningful start.  Fix
  zombies percentage calculation.  Simplify elapsed time calculation.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-29 11:20:43 +0000
+++ b/src/ChangeLog     2012-07-29 13:51:45 +0000
@@ -1,5 +1,11 @@
 2012-07-29  Dmitry Antipov  <address@hidden>
 
+       Cleanup statistics calculation in Fgarbage_collect.
+       * alloc.c (Fgarbage_collect): Rename t1 to meaningful start.  Fix
+       zombies percentage calculation.  Simplify elapsed time calculation.
+
+2012-07-29  Dmitry Antipov  <address@hidden>
+
        Generalize marker debugging code under MARKER_DEBUG and use eassert.
        * insdel.c (CHECK_MARKERS, check_markers_debug_flag): Remove.
        (gap_left, gap_right, adjust_markers_for_delete, insert_1_both)

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-28 23:05:32 +0000
+++ b/src/alloc.c       2012-07-29 13:51:45 +0000
@@ -5437,7 +5437,7 @@
   int message_p;
   Lisp_Object total[11];
   ptrdiff_t count = SPECPDL_INDEX ();
-  EMACS_TIME t1;
+  EMACS_TIME start;
 
   if (abort_on_gc)
     abort ();
@@ -5454,7 +5454,7 @@
   FOR_EACH_BUFFER (nextb)
     compact_buffer (nextb);
 
-  t1 = current_emacs_time ();
+  start = current_emacs_time ();
 
   /* In case user calls debug_print during GC,
      don't let that cause a recursive GC.  */
@@ -5706,18 +5706,16 @@
 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
   {
     /* Compute average percentage of zombies.  */
-    double nlive = 0;
-
-    for (i = 0; i < 7; ++i)
-      if (CONSP (total[i]))
-       nlive += XFASTINT (XCAR (total[i]));
+    double nlive = 
+      total_conses + total_symbols + total_markers + total_strings
+      + total_vectors + total_floats + total_intervals + total_buffers;
 
     avg_live = (avg_live * ngcs + nlive) / (ngcs + 1);
     max_live = max (nlive, max_live);
     avg_zombies = (avg_zombies * ngcs + nzombies) / (ngcs + 1);
     max_zombies = max (nzombies, max_zombies);
     ++ngcs;
-    }
+  }
 #endif
 
   if (!NILP (Vpost_gc_hook))
@@ -5729,12 +5727,9 @@
 
   /* Accumulate statistics.  */
   if (FLOATP (Vgc_elapsed))
-    {
-      EMACS_TIME t2 = current_emacs_time ();
-      EMACS_TIME t3 = sub_emacs_time (t2, t1);
-      Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed)
-                               + EMACS_TIME_TO_DOUBLE (t3));
-    }
+    Vgc_elapsed = make_float
+      (XFLOAT_DATA (Vgc_elapsed) + EMACS_TIME_TO_DOUBLE
+       (sub_emacs_time (current_emacs_time (), start)));
 
   gcs_done++;
 


reply via email to

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