< prev index next >

src/hotspot/share/cds/dumpAllocStats.cpp

Print this page
*** 100,5 ***
--- 100,17 ---
           "everything should have been counted (used/counted: ro %d/%d, rw %d/%d",
           ro_all, all_ro_bytes, rw_all, all_rw_bytes);
  
  #undef fmt_stats
  }
+ 
+ #ifdef ASSERT
+ void DumpAllocStats::verify(int expected_byte_size, bool read_only) const {
+   int bytes = 0;
+   const int what = (int)(read_only ? RO : RW);
+   for (int type = 0; type < int(_number_of_types); type ++) {
+     bytes += _bytes[what][type];
+   }
+   assert(bytes == expected_byte_size, "counter mismatch (%s: %d vs %d)",
+          (read_only ? "RO" : "RW"), bytes, expected_byte_size);
+ }
+ #endif // ASSERT
< prev index next >