少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
 * \file
 * Copyright Xamarin Inc (http://www.xamarin.com)
 *
 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
 */
 
#include "config.h"
#ifdef HAVE_SGEN_GC
 
#include "sgen/sgen-gc.h"
#include "sgen/sgen-layout-stats.h"
#include <mono/utils/mono-compiler.h>
 
#ifdef SGEN_OBJECT_LAYOUT_STATISTICS
 
#define NUM_HISTOGRAM_ENTRIES    (1 << SGEN_OBJECT_LAYOUT_BITMAP_BITS)
 
static unsigned long histogram [NUM_HISTOGRAM_ENTRIES];
static unsigned long count_bitmap_overflow;
static unsigned long count_ref_array;
static unsigned long count_vtype_array;
 
void
sgen_object_layout_scanned_bitmap (unsigned int bitmap)
{
    g_assert (!(bitmap >> SGEN_OBJECT_LAYOUT_BITMAP_BITS));
    ++histogram [bitmap];
}
 
void
sgen_object_layout_scanned_bitmap_overflow (void)
{
    ++count_bitmap_overflow;
}
 
void
sgen_object_layout_scanned_ref_array (void)
{
    ++count_ref_array;
}
 
void
sgen_object_layout_scanned_vtype_array (void)
{
    ++count_vtype_array;
}
 
void
sgen_object_layout_dump (FILE *out)
{
    int i;
 
    for (i = 0; i < NUM_HISTOGRAM_ENTRIES; ++i) {
        if (!histogram [i])
            continue;
        fprintf (out, "%d %lu\n", i, histogram [i]);
    }
    fprintf (out, "bitmap-overflow %lu\n", count_bitmap_overflow);
    fprintf (out, "ref-array %lu\n", count_ref_array);
    fprintf (out, "vtype-array %lu\n", count_vtype_array);
}
#else
 
MONO_EMPTY_SOURCE_FILE (sgen_layout_stats);
#endif /* SGEN_OBJECT_LAYOUT_STATISTICS */
#endif