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.
27 #include "sgen/sgen-gc.h"
28 #include "sgen/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;
40 sgen_object_layout_scanned_bitmap (unsigned int bitmap)
42 g_assert (!(bitmap >> SGEN_OBJECT_LAYOUT_BITMAP_BITS));
47 sgen_object_layout_scanned_bitmap_overflow (void)
49 ++count_bitmap_overflow;
53 sgen_object_layout_scanned_ref_array (void)
59 sgen_object_layout_scanned_vtype_array (void)
65 sgen_object_layout_dump (FILE *out)
69 for (i = 0; i < NUM_HISTOGRAM_ENTRIES; ++i) {
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);