[tools] Add nuget-hash-extractor tool to help produce the runtime ignored assemblies...
[mono-project.git] / mono / sgen / sgen-layout-stats.c
blob04b1f241e1abaff2b96990b572e1bdf5e5bf8907
1 /*
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.
5 */
7 #include "config.h"
8 #ifdef HAVE_SGEN_GC
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;
23 void
24 sgen_object_layout_scanned_bitmap (unsigned int bitmap)
26 g_assert (!(bitmap >> SGEN_OBJECT_LAYOUT_BITMAP_BITS));
27 ++histogram [bitmap];
30 void
31 sgen_object_layout_scanned_bitmap_overflow (void)
33 ++count_bitmap_overflow;
36 void
37 sgen_object_layout_scanned_ref_array (void)
39 ++count_ref_array;
42 void
43 sgen_object_layout_scanned_vtype_array (void)
45 ++count_vtype_array;
48 void
49 sgen_object_layout_dump (FILE *out)
51 int i;
53 for (i = 0; i < NUM_HISTOGRAM_ENTRIES; ++i) {
54 if (!histogram [i])
55 continue;
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);
62 #else
64 MONO_EMPTY_SOURCE_FILE (sgen_layout_stats);
65 #endif /* SGEN_OBJECT_LAYOUT_STATISTICS */
66 #endif