mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 06:20:23 +02:00
get heap stats with GC_get_heap_usage_safe, if available.
* configure.ac: Check for GC_get_heap_usage_safe. * libguile/gc.c (SCM_DEFINE): Use GC_get_heap_usage_safe.
This commit is contained in:
parent
59a0273338
commit
14294ce0df
2 changed files with 21 additions and 7 deletions
|
@ -1259,7 +1259,7 @@ save_LIBS="$LIBS"
|
|||
LIBS="$BDW_GC_LIBS $LIBS"
|
||||
CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
|
||||
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback])
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback GC_get_heap_usage_safe])
|
||||
|
||||
# Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not
|
||||
# declared, and has a different type (returning void instead of
|
||||
|
|
|
@ -192,6 +192,22 @@ SCM_DEFINE (scm_set_debug_cell_accesses_x, "set-debug-cell-accesses!", 1, 0, 0,
|
|||
|
||||
#endif /* SCM_DEBUG_CELL_ACCESSES == 1 */
|
||||
|
||||
|
||||
|
||||
#ifndef HAVE_GC_GET_HEAP_USAGE_SAFE
|
||||
static void
|
||||
GC_get_heap_usage_safe (GC_word *pheap_size, GC_word *pfree_bytes,
|
||||
GC_word *punmapped_bytes, GC_word *pbytes_since_gc,
|
||||
GC_word *ptotal_bytes)
|
||||
{
|
||||
*pheap_size = GC_get_heap_size ();
|
||||
*pfree_bytes = GC_get_free_bytes ();
|
||||
*punmapped_bytes = GC_get_unmapped_bytes ();
|
||||
*pbytes_since_gc = GC_get_bytes_since_gc ();
|
||||
*ptotal_bytes = GC_get_total_bytes ();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Hooks. */
|
||||
scm_t_c_hook scm_before_gc_c_hook;
|
||||
|
@ -275,14 +291,12 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
|
|||
#define FUNC_NAME s_scm_gc_stats
|
||||
{
|
||||
SCM answer;
|
||||
size_t heap_size, free_bytes, bytes_since_gc, total_bytes;
|
||||
GC_word heap_size, free_bytes, unmapped_bytes, bytes_since_gc, total_bytes;
|
||||
size_t gc_times;
|
||||
|
||||
heap_size = GC_get_heap_size ();
|
||||
free_bytes = GC_get_free_bytes ();
|
||||
bytes_since_gc = GC_get_bytes_since_gc ();
|
||||
total_bytes = GC_get_total_bytes ();
|
||||
gc_times = GC_gc_no;
|
||||
GC_get_heap_usage_safe (&heap_size, &free_bytes, &unmapped_bytes,
|
||||
&bytes_since_gc, &total_bytes);
|
||||
gc_times = GC_gc_no;
|
||||
|
||||
answer =
|
||||
scm_list_n (scm_cons (sym_gc_time_taken, scm_from_long (gc_time_taken)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue