3 * Copyright Xamarin Inc (http://www.xamarin.com)
5 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
11 #include "sgen/sgen-gc.h"
12 #include "sgen/sgen-layout-stats.h"
13 #include <mono/utils/mono-compiler.h>
15 #ifdef SGEN_OBJECT_LAYOUT_STATISTICS
17 #define NUM_HISTOGRAM_ENTRIES (1 << SGEN_OBJECT_LAYOUT_BITMAP_BITS)
19 static unsigned long histogram
[NUM_HISTOGRAM_ENTRIES
];
20 static unsigned long count_bitmap_overflow
;
21 static unsigned long count_ref_array
;
22 static unsigned long count_vtype_array
;
25 sgen_object_layout_scanned_bitmap (unsigned int bitmap
)
27 g_assert (!(bitmap
>> SGEN_OBJECT_LAYOUT_BITMAP_BITS
));
32 sgen_object_layout_scanned_bitmap_overflow (void)
34 ++count_bitmap_overflow
;
38 sgen_object_layout_scanned_ref_array (void)
44 sgen_object_layout_scanned_vtype_array (void)
50 sgen_object_layout_dump (FILE *out
)
54 for (i
= 0; i
< NUM_HISTOGRAM_ENTRIES
; ++i
) {
57 fprintf (out
, "%d %lu\n", i
, histogram
[i
]);
59 fprintf (out
, "bitmap-overflow %lu\n", count_bitmap_overflow
);
60 fprintf (out
, "ref-array %lu\n", count_ref_array
);
61 fprintf (out
, "vtype-array %lu\n", count_vtype_array
);
65 MONO_EMPTY_SOURCE_FILE (sgen_layout_stats
);
66 #endif /* SGEN_OBJECT_LAYOUT_STATISTICS */