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"
13 #ifdef SGEN_OBJECT_LAYOUT_STATISTICS
15 #define NUM_HISTOGRAM_ENTRIES (1 << SGEN_OBJECT_LAYOUT_BITMAP_BITS)
17 static unsigned long histogram [NUM_HISTOGRAM_ENTRIES];
18 static unsigned long count_bitmap_overflow;
19 static unsigned long count_ref_array;
20 static unsigned long count_vtype_array;
23 sgen_object_layout_scanned_bitmap (unsigned int bitmap)
25 g_assert (!(bitmap >> SGEN_OBJECT_LAYOUT_BITMAP_BITS));
30 sgen_object_layout_scanned_bitmap_overflow (void)
32 ++count_bitmap_overflow;
36 sgen_object_layout_scanned_ref_array (void)
42 sgen_object_layout_scanned_vtype_array (void)
48 sgen_object_layout_dump (FILE *out)
52 for (i = 0; i < NUM_HISTOGRAM_ENTRIES; ++i) {
55 fprintf (out, "%d %lu\n", i, histogram [i]);
57 fprintf (out, "bitmap-overflow %lu\n", count_bitmap_overflow);
58 fprintf (out, "ref-array %lu\n", count_ref_array);
59 fprintf (out, "vtype-array %lu\n", count_vtype_array);
64 // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
65 void __mono_win32_sgen_layout_stats_quiet_lnk4221(void) {}
67 #endif /* SGEN_OBJECT_LAYOUT_STATISTICS */