]> granicus.if.org Git - gc/commitdiff
New field (expl_freed_bytes_since_gc) in public prof_stats_s
authorIvan Maidanski <ivmai@mail.ru>
Thu, 11 Jan 2018 22:08:37 +0000 (01:08 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 11 Jan 2018 22:08:37 +0000 (01:08 +0300)
* include/gc.h (GC_prof_stats_s): Add expl_freed_bytes_since_gc field
(to the end of the structure).
* misc.c [!GC_GET_HEAP_USAGE_NOT_NEEDED] (fill_prof_stats): Store
GC_bytes_freed value to pstats->expl_freed_bytes_since_gc.

include/gc.h
misc.c

index 24a2bd0eaa1ddfb1961bb8e621c87258827ea75f..471f57fb028a142af4ed3854979cc1842a695b87 100644 (file)
@@ -744,6 +744,9 @@ struct GC_prof_stats_s {
   GC_word reclaimed_bytes_before_gc;
             /* Approximate number of bytes reclaimed before the recent  */
             /* garbage collection.  The value may wrap.                 */
+  GC_word expl_freed_bytes_since_gc;
+            /* Number of bytes freed explicitly since the recent GC.    */
+            /* Same as returned by GC_get_expl_freed_bytes_since_gc().  */
 };
 
 /* Atomically get GC statistics (various global counters).  Clients     */
diff --git a/misc.c b/misc.c
index 0c40e9baa1462779db29c6a86cf0b84cea129d0c..70f5e9f038c95770be3f5da00c7f02202a7dcfb2 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -521,6 +521,7 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size,
     pstats->bytes_reclaimed_since_gc = GC_bytes_found > 0 ?
                                         (word)GC_bytes_found : 0;
     pstats->reclaimed_bytes_before_gc = GC_reclaimed_bytes_before_gc;
+    pstats->expl_freed_bytes_since_gc = GC_bytes_freed; /* since gc-7.7 */
   }
 
 # include <string.h> /* for memset() */