GET_TIME(start_time);
# endif
+# ifndef GC_GET_HEAP_USAGE_NOT_NEEDED
+ if (GC_bytes_found > 0)
+ GC_reclaimed_bytes_before_gc += (word)GC_bytes_found;
+# endif
GC_bytes_found = 0;
# if defined(LINUX) && defined(__ELF__) && !defined(SMALL_CONFIG)
if (GETENV("GC_PRINT_ADDRESS_MAP") != 0) {
/* Number of marker threads (excluding the initiating one). */
/* Same as returned by GC_get_parallel (or 0 if the */
/* collector is single-threaded). */
+ GC_word bytes_reclaimed_since_gc;
+ /* Approximate number of reclaimed bytes after recent GC. */
+ GC_word reclaimed_bytes_before_gc;
+ /* Approximate number of bytes reclaimed before the recent */
+ /* garbage collection. The value may wrap. */
};
/* Atomically get GC statistics (various global counters). Clients */
/* Number of reclaimed bytes after garbage collection; */
/* protected by GC lock; defined in reclaim.c. */
+#ifndef GC_GET_HEAP_USAGE_NOT_NEEDED
+ GC_EXTERN word GC_reclaimed_bytes_before_gc;
+ /* Number of bytes reclaimed before this */
+ /* collection cycle; used for statistics only. */
+#endif
+
#ifdef USE_MUNMAP
GC_EXTERN int GC_unmap_threshold; /* defined in allchblk.c */
GC_EXTERN GC_bool GC_force_unmap_on_gcollect; /* defined in misc.c */
UNLOCK();
}
+ GC_INNER word GC_reclaimed_bytes_before_gc = 0;
+
/* Fill in GC statistics provided the destination is of enough size. */
static void fill_prof_stats(struct GC_prof_stats_s *pstats)
{
# else
pstats->markers_m1 = 0; /* one marker */
# endif
+ pstats->bytes_reclaimed_since_gc = GC_bytes_found > 0 ?
+ (word)GC_bytes_found : 0;
+ pstats->reclaimed_bytes_before_gc = GC_reclaimed_bytes_before_gc;
}
# include <string.h> /* for memset() */
(unsigned long)max_heap_sz);
FAIL;
}
+
+# ifndef GC_GET_HEAP_USAGE_NOT_NEEDED
+ /* Get global counters (just to check the functions work). */
+ GC_get_heap_usage_safe(NULL, NULL, NULL, NULL, NULL);
+ {
+ struct GC_prof_stats_s stats;
+ (void)GC_get_prof_stats(&stats, sizeof(stats));
+# ifdef THREADS
+ (void)GC_get_prof_stats_unsafe(&stats, sizeof(stats));
+# endif
+ }
+# endif
+
# ifdef THREADS
GC_unregister_my_thread(); /* just to check it works (for main) */
# endif