Revert some changes which don't have proper dependencies.
[mono-project.git] / mono / sgen / sgen-layout-stats.c
blob103ef31436465d683b500229926c512e575adc03
1 /**
2 * \file
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.
6 */
8 #include "config.h"
9 #ifdef HAVE_SGEN_GC
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;
24 void
25 sgen_object_layout_scanned_bitmap (unsigned int bitmap)
27 g_assert (!(bitmap >> SGEN_OBJECT_LAYOUT_BITMAP_BITS));
28 ++histogram [bitmap];
31 void
32 sgen_object_layout_scanned_bitmap_overflow (void)
34 ++count_bitmap_overflow;
37 void
38 sgen_object_layout_scanned_ref_array (void)
40 ++count_ref_array;
43 void
44 sgen_object_layout_scanned_vtype_array (void)
46 ++count_vtype_array;
49 void
50 sgen_object_layout_dump (FILE *out)
52 int i;
54 for (i = 0; i < NUM_HISTOGRAM_ENTRIES; ++i) {
55 if (!histogram [i])
56 continue;
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);
63 #else
65 MONO_EMPTY_SOURCE_FILE (sgen_layout_stats);
66 #endif /* SGEN_OBJECT_LAYOUT_STATISTICS */
67 #endif