@@ -97,7 +97,6 @@ void MemReporterBase::print_virtual_memory_region(const char* type, address base
97
97
98
98
99
99
void MemSummaryReporter::report () {
100
- const char * scale = current_scale ();
101
100
outputStream* out = output ();
102
101
size_t total_reserved_amount = _malloc_snapshot->total () +
103
102
_vm_snapshot->total_reserved ();
@@ -106,6 +105,12 @@ void MemSummaryReporter::report() {
106
105
107
106
// Overall total
108
107
out->print_cr (" \n Native Memory Tracking:\n " );
108
+
109
+ if (scale () > 1 ) {
110
+ out->print_cr (" (Omitting categories weighting less than 1%s)" , current_scale ());
111
+ out->cr ();
112
+ }
113
+
109
114
out->print (" Total: " );
110
115
print_total (total_reserved_amount, total_committed_amount);
111
116
out->print (" \n " );
@@ -243,22 +248,35 @@ void MemDetailReporter::report_detail() {
243
248
outputStream* out = output ();
244
249
out->print_cr (" Details:\n " );
245
250
246
- report_malloc_sites ();
247
- report_virtual_memory_allocation_sites ();
251
+ int num_omitted =
252
+ report_malloc_sites () +
253
+ report_virtual_memory_allocation_sites ();
254
+ if (num_omitted > 0 ) {
255
+ assert (scale () > 1 , " sanity" );
256
+ out->print_cr (" (%d call sites weighting less than 1%s each omitted.)" ,
257
+ num_omitted, current_scale ());
258
+ out->cr ();
259
+ }
248
260
}
249
261
250
- void MemDetailReporter::report_malloc_sites () {
262
+ int MemDetailReporter::report_malloc_sites () {
251
263
MallocSiteIterator malloc_itr = _baseline.malloc_sites (MemBaseline::by_size);
252
- if (malloc_itr.is_empty ()) return ;
264
+ if (malloc_itr.is_empty ()) return 0 ;
253
265
254
266
outputStream* out = output ();
255
267
256
268
const MallocSite* malloc_site;
269
+ int num_omitted = 0 ;
257
270
while ((malloc_site = malloc_itr.next ()) != NULL ) {
258
- // Don't report if size is too small
259
- if (amount_in_current_scale ( malloc_site->size ()) == 0 )
271
+ // Don't report free sites; does not count toward omitted count.
272
+ if (malloc_site->size () == 0 ) {
260
273
continue ;
261
-
274
+ }
275
+ // Don't report if site has allocated less than one unit of whatever our scale is
276
+ if (scale () > 1 && amount_in_current_scale (malloc_site->size ()) == 0 ) {
277
+ num_omitted ++;
278
+ continue ;
279
+ }
262
280
const NativeCallStack* stack = malloc_site->call_stack ();
263
281
stack->print_on (out);
264
282
out->print (" %29s" , " " );
@@ -268,22 +286,28 @@ void MemDetailReporter::report_malloc_sites() {
268
286
print_malloc (malloc_site->size (), malloc_site->count (),flag);
269
287
out->print_cr (" \n " );
270
288
}
289
+ return num_omitted;
271
290
}
272
291
273
- void MemDetailReporter::report_virtual_memory_allocation_sites () {
292
+ int MemDetailReporter::report_virtual_memory_allocation_sites () {
274
293
VirtualMemorySiteIterator virtual_memory_itr =
275
294
_baseline.virtual_memory_sites (MemBaseline::by_size);
276
295
277
- if (virtual_memory_itr.is_empty ()) return ;
296
+ if (virtual_memory_itr.is_empty ()) return 0 ;
278
297
279
298
outputStream* out = output ();
280
299
const VirtualMemoryAllocationSite* virtual_memory_site;
281
-
300
+ int num_omitted = 0 ;
282
301
while ((virtual_memory_site = virtual_memory_itr.next ()) != NULL ) {
283
- // Don't report if size is too small
284
- if (amount_in_current_scale ( virtual_memory_site->reserved ()) == 0 )
302
+ // Don't report free sites; does not count toward omitted count.
303
+ if (virtual_memory_site->reserved () == 0 ) {
285
304
continue ;
286
-
305
+ }
306
+ // Don't report if site has reserved less than one unit of whatever our scale is
307
+ if (scale () > 1 && amount_in_current_scale (virtual_memory_site->reserved ()) == 0 ) {
308
+ num_omitted++;
309
+ continue ;
310
+ }
287
311
const NativeCallStack* stack = virtual_memory_site->call_stack ();
288
312
stack->print_on (out);
289
313
out->print (" %28s (" , " " );
@@ -294,6 +318,7 @@ void MemDetailReporter::report_virtual_memory_allocation_sites() {
294
318
}
295
319
out->print_cr (" )\n " );
296
320
}
321
+ return num_omitted;
297
322
}
298
323
299
324
@@ -359,10 +384,14 @@ void MemDetailReporter::report_virtual_memory_region(const ReservedMemoryRegion*
359
384
}
360
385
361
386
void MemSummaryDiffReporter::report_diff () {
362
- const char * scale = current_scale ();
363
387
outputStream* out = output ();
364
388
out->print_cr (" \n Native Memory Tracking:\n " );
365
389
390
+ if (scale () > 1 ) {
391
+ out->print_cr (" (Omitting categories weighting less than 1%s)" , current_scale ());
392
+ out->cr ();
393
+ }
394
+
366
395
// Overall diff
367
396
out->print (" Total: " );
368
397
print_virtual_memory_diff (_current_baseline.total_reserved_memory (),
0 commit comments