[utils] Small header sanitization. networking.h now include config.h
[mono-project.git] / mono / metadata / sgen-layout-stats.c
blob8342bff9d4089566cd97333d60fa82676646415a
1 /*
2 * Copyright Xamarin Inc (http://www.xamarin.com)
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #include "config.h"
25 #ifdef HAVE_SGEN_GC
27 #include "metadata/sgen-gc.h"
28 #include "metadata/sgen-layout-stats.h"
30 #ifdef SGEN_OBJECT_LAYOUT_STATISTICS
32 #define NUM_HISTOGRAM_ENTRIES (1 << SGEN_OBJECT_LAYOUT_BITMAP_BITS)
34 static unsigned long histogram [NUM_HISTOGRAM_ENTRIES];
35 static unsigned long count_bitmap_overflow;
36 static unsigned long count_ref_array;
37 static unsigned long count_vtype_array;
39 void
40 sgen_object_layout_scanned_bitmap (unsigned int bitmap)
42 g_assert (!(bitmap >> SGEN_OBJECT_LAYOUT_BITMAP_BITS));
43 ++histogram [bitmap];
46 void
47 sgen_object_layout_scanned_bitmap_overflow (void)
49 ++count_bitmap_overflow;
52 void
53 sgen_object_layout_scanned_ref_array (void)
55 ++count_ref_array;
58 void
59 sgen_object_layout_scanned_vtype_array (void)
61 ++count_vtype_array;
64 void
65 sgen_object_layout_dump (FILE *out)
67 int i;
69 for (i = 0; i < NUM_HISTOGRAM_ENTRIES; ++i) {
70 if (!histogram [i])
71 continue;
72 fprintf (out, "%d %lu\n", i, histogram [i]);
74 fprintf (out, "bitmap-overflow %lu\n", count_bitmap_overflow);
75 fprintf (out, "ref-array %lu\n", count_ref_array);
76 fprintf (out, "vtype-array %lu\n", count_vtype_array);
79 #endif
80 #endif