2 * Copyright Xamarin Inc (http://www.xamarin.com)
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
10 #include "sgen/sgen-gc.h"
11 #include "sgen/sgen-layout-stats.h"
12 #include <mono/utils/mono-compiler.h>
14 #ifdef SGEN_OBJECT_LAYOUT_STATISTICS
16 #define NUM_HISTOGRAM_ENTRIES (1 << SGEN_OBJECT_LAYOUT_BITMAP_BITS)
18 static unsigned long histogram [NUM_HISTOGRAM_ENTRIES];
19 static unsigned long count_bitmap_overflow;
20 static unsigned long count_ref_array;
21 static unsigned long count_vtype_array;
24 sgen_object_layout_scanned_bitmap (unsigned int bitmap)
26 g_assert (!(bitmap >> SGEN_OBJECT_LAYOUT_BITMAP_BITS));
31 sgen_object_layout_scanned_bitmap_overflow (void)
33 ++count_bitmap_overflow;
37 sgen_object_layout_scanned_ref_array (void)
43 sgen_object_layout_scanned_vtype_array (void)
49 sgen_object_layout_dump (FILE *out)
53 for (i = 0; i < NUM_HISTOGRAM_ENTRIES; ++i) {
56 fprintf (out, "%d %lu\n", i, histogram [i]);
58 fprintf (out, "bitmap-overflow %lu\n", count_bitmap_overflow);
59 fprintf (out, "ref-array %lu\n", count_ref_array);
60 fprintf (out, "vtype-array %lu\n", count_vtype_array);
64 MONO_EMPTY_SOURCE_FILE (sgen_layout_stats);
65 #endif /* SGEN_OBJECT_LAYOUT_STATISTICS */