Add statistics about the nr of used linesF
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15237 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c
index d7710c2..ef887e3 100644
--- a/helgrind/libhb_core.c
+++ b/helgrind/libhb_core.c
@@ -899,6 +899,34 @@
}
}
+/* Returns the nr of linesF which are in use. Note: this is scanning
+ the secmap wordFM. So, this is to be used for statistics only. */
+__attribute__((noinline))
+static UWord shmem__SecMap_used_linesF(void)
+{
+ UWord secmapW = 0;
+ Addr gaKey;
+ UWord inUse = 0;
+ UWord total = 0;
+
+ VG_(initIterFM)( map_shmem );
+ while (VG_(nextIterFM)( map_shmem, &gaKey, &secmapW )) {
+ UWord i;
+ SecMap* sm = (SecMap*)secmapW;
+ tl_assert(sm->magic == SecMap_MAGIC);
+
+ for (i = 0; i < sm->linesF_size; i++) {
+ LineF* lineF = &sm->linesF[i];
+ if (lineF->inUse)
+ inUse++;
+ total++;
+ }
+ }
+ VG_(doneIterFM)( map_shmem );
+ tl_assert (stats__secmap_linesF_allocd == total);
+
+ return inUse;
+}
/* ------------ LineF and LineZ related ------------ */
@@ -6334,9 +6362,10 @@
VG_(printf)(" linesZ: %'10lu allocd (%'12lu bytes occupied)\n",
stats__secmap_linesZ_allocd,
stats__secmap_linesZ_bytes);
- VG_(printf)(" linesF: %'10lu allocd (%'12lu bytes occupied)\n",
- stats__secmap_linesF_allocd,
- stats__secmap_linesF_bytes);
+ VG_(printf)(" linesF: %'10lu allocd (%'12lu bytes occupied)"
+ " (%'10lu used)\n",
+ stats__secmap_linesF_allocd, stats__secmap_linesF_bytes,
+ shmem__SecMap_used_linesF());
VG_(printf)(" secmaps: %'10lu in map (can be scanGCed %'5lu)"
" #%lu scanGC \n",
stats__secmaps_in_map_shmem,