[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/alloc.c
From: |
Dave Love |
Subject: |
[Emacs-diffs] Changes to emacs/src/alloc.c |
Date: |
Thu, 30 Jan 2003 09:15:59 -0500 |
Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.290 emacs/src/alloc.c:1.291
*** emacs/src/alloc.c:1.290 Fri Jan 24 07:24:13 2003
--- emacs/src/alloc.c Thu Jan 30 09:15:58 2003
***************
*** 256,261 ****
--- 256,264 ----
Lisp_Object Vpost_gc_hook, Qpost_gc_hook;
+ Lisp_Object Vgc_elapsed; /* accumulated elapsed time in GC */
+ EMACS_INT gcs_done; /* accumulated GCs */
+
static void mark_buffer P_ ((Lisp_Object));
static void mark_kboards P_ ((void));
static void gc_sweep P_ ((void));
***************
*** 645,652 ****
elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
pairs; unfortunately, we have no idea what C library functions
might call malloc, so we can't really protect them unless you're
! using GNU malloc. Fortunately, most of the major operating can use
! GNU malloc. */
#ifndef SYSTEM_MALLOC
#ifndef DOUG_LEA_MALLOC
--- 648,655 ----
elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT
pairs; unfortunately, we have no idea what C library functions
might call malloc, so we can't really protect them unless you're
! using GNU malloc. Fortunately, most of the major operating systems
! can use GNU malloc. */
#ifndef SYSTEM_MALLOC
#ifndef DOUG_LEA_MALLOC
***************
*** 1236,1242 ****
return nbytes;
}
! /* Check validity Lisp strings' string_bytes member in B. */
void
check_sblock (b)
--- 1239,1245 ----
return nbytes;
}
! /* Check validity of Lisp strings' string_bytes member in B. */
void
check_sblock (b)
***************
*** 4085,4090 ****
--- 4088,4096 ----
int message_p;
Lisp_Object total[8];
int count = SPECPDL_INDEX ();
+ EMACS_TIME t1, t2, t3;
+
+ EMACS_GET_TIME (t1);
/* Can't GC if pure storage overflowed because we can't determine
if something is a pure object or not. */
***************
*** 4370,4376 ****
safe_run_hooks (Qpost_gc_hook);
unbind_to (count, Qnil);
}
!
return Flist (sizeof total / sizeof *total, total);
}
--- 4376,4391 ----
safe_run_hooks (Qpost_gc_hook);
unbind_to (count, Qnil);
}
!
! /* Accumulate statistics. */
! EMACS_GET_TIME (t2);
! EMACS_SUB_TIME (t3, t2, t1);
! if (FLOATP (Vgc_elapsed))
! XSETFLOAT (Vgc_elapsed, make_float (XFLOAT_DATA (Vgc_elapsed) +
! EMACS_SECS (t3) +
! EMACS_USECS (t3) * 1.0e-6));
! gcs_done++;
!
return Flist (sizeof total / sizeof *total, total);
}
***************
*** 5525,5530 ****
--- 5540,5547 ----
setjmp_tested_p = longjmps_done = 0;
#endif
#endif
+ Vgc_elapsed = make_float (0.0);
+ gcs_done = 0;
}
void
***************
*** 5613,5618 ****
--- 5630,5643 ----
staticpro (&Qchar_table_extra_slots);
Qchar_table_extra_slots = intern ("char-table-extra-slots");
+
+ DEFVAR_LISP ("gc-elapsed", &Vgc_elapsed,
+ doc: /* Accumulated time elapsed in garbage collections.
+ The time is in seconds as a floating point value.
+ Programs may reset this to get statistics in a specific period. */);
+ DEFVAR_INT ("gcs-done", &gcs_done,
+ doc: /* Accumulated number of garbage collections done.
+ Programs may reset this to get statistics in a specific period. */);
defsubr (&Scons);
defsubr (&Slist);