mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 01:41:18 -10:00
[sgen] Move counters to client code.
This commit is contained in:
1 parent
bb22ad20a7
commit
5f33085d65
16 files changed
+57
-51
No files matched your search
@@ -44,7 +44,6 @@
|
||||
#include "metadata/sgen-memory-governor.h"
|
||||
#include "metadata/sgen-client.h"
|
||||
#include "utils/mono-memory-model.h"
|
||||
#include "utils/mono-counters.h"
|
||||
|
||||
#define ALIGN_UP SGEN_ALIGN_UP
|
||||
#define ALLOC_ALIGN SGEN_ALLOC_ALIGN
|
||||
@@ -593,7 +592,7 @@ sgen_init_allocator (void)
|
||||
#endif
|
||||
|
||||
#ifdef HEAVY_STATISTICS
|
||||
mono_counters_register ("# objects allocated", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_objects_alloced);
|
||||
mono_counters_register ("# objects allocated", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_objects_alloced);
|
||||
mono_counters_register ("bytes allocated", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_bytes_alloced);
|
||||
mono_counters_register ("bytes allocated in LOS", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_bytes_alloced_los);
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "metadata/sgen-protocol.h"
|
||||
#include "metadata/sgen-layout-stats.h"
|
||||
#include "metadata/sgen-client.h"
|
||||
#include "utils/mono-counters.h"
|
||||
#include "utils/mono-time.h"
|
||||
#include "utils/mono-memory-model.h"
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ sgen_client_par_object_get_size (GCVTable *vtable, GCObject* o)
|
||||
|
||||
#include "metadata/profiler-private.h"
|
||||
#include "utils/dtrace.h"
|
||||
#include "utils/mono-counters.h"
|
||||
|
||||
extern void mono_sgen_register_moved_object (void *obj, void *destination);
|
||||
extern void mono_sgen_gc_event_moves (void);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <metadata/sgen-pointer-queue.h>
|
||||
|
||||
void sgen_client_init_early (void);
|
||||
void sgen_client_init (void);
|
||||
|
||||
mword sgen_client_slow_object_get_size (GCVTable *vtable, GCObject* o);
|
||||
@@ -80,6 +81,8 @@ void sgen_client_pinned_los_object (char *obj);
|
||||
void sgen_client_collecting_major_2 (void);
|
||||
void sgen_client_collecting_major_3 (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue);
|
||||
|
||||
void sgen_client_total_allocated_heap (mword allocated_heap);
|
||||
|
||||
/*
|
||||
* If the client has registered any internal memory types, this must return a string
|
||||
* describing the given type. Only used for debugging.
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#define _XOPEN_SOURCE
|
||||
#endif
|
||||
|
||||
#include "utils/mono-counters.h"
|
||||
#include "metadata/sgen-gc.h"
|
||||
|
||||
#define MAX_USER_DESCRIPTORS 16
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "metadata/sgen-protocol.h"
|
||||
#include "metadata/sgen-pointer-queue.h"
|
||||
#include "metadata/sgen-client.h"
|
||||
#include "utils/mono-counters.h"
|
||||
|
||||
#define ptr_in_nursery sgen_ptr_in_nursery
|
||||
|
||||
|
||||
+19
-20
@@ -206,7 +206,6 @@
|
||||
#include "utils/mono-mmap.h"
|
||||
#include "utils/mono-time.h"
|
||||
#include "utils/mono-semaphore.h"
|
||||
#include "utils/mono-counters.h"
|
||||
#include "utils/mono-proclib.h"
|
||||
#include "utils/mono-memory-model.h"
|
||||
|
||||
@@ -293,15 +292,15 @@ guint64 stat_nursery_copy_object_failed_forwarded = 0;
|
||||
guint64 stat_nursery_copy_object_failed_pinned = 0;
|
||||
guint64 stat_nursery_copy_object_failed_to_space = 0;
|
||||
|
||||
static int stat_wbarrier_add_to_global_remset = 0;
|
||||
static int stat_wbarrier_set_field = 0;
|
||||
static int stat_wbarrier_set_arrayref = 0;
|
||||
static int stat_wbarrier_arrayref_copy = 0;
|
||||
static int stat_wbarrier_generic_store = 0;
|
||||
static int stat_wbarrier_generic_store_atomic = 0;
|
||||
static int stat_wbarrier_set_root = 0;
|
||||
static int stat_wbarrier_value_copy = 0;
|
||||
static int stat_wbarrier_object_copy = 0;
|
||||
static guint64 stat_wbarrier_add_to_global_remset = 0;
|
||||
static guint64 stat_wbarrier_set_field = 0;
|
||||
static guint64 stat_wbarrier_set_arrayref = 0;
|
||||
static guint64 stat_wbarrier_arrayref_copy = 0;
|
||||
static guint64 stat_wbarrier_generic_store = 0;
|
||||
static guint64 stat_wbarrier_generic_store_atomic = 0;
|
||||
static guint64 stat_wbarrier_set_root = 0;
|
||||
static guint64 stat_wbarrier_value_copy = 0;
|
||||
static guint64 stat_wbarrier_object_copy = 0;
|
||||
#endif
|
||||
|
||||
static guint64 stat_pinned_objects = 0;
|
||||
@@ -1345,15 +1344,15 @@ init_stats (void)
|
||||
mono_counters_register ("Number of pinned objects", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_pinned_objects);
|
||||
|
||||
#ifdef HEAVY_STATISTICS
|
||||
mono_counters_register ("WBarrier remember pointer", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_add_to_global_remset);
|
||||
mono_counters_register ("WBarrier set field", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_set_field);
|
||||
mono_counters_register ("WBarrier set arrayref", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_set_arrayref);
|
||||
mono_counters_register ("WBarrier arrayref copy", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_arrayref_copy);
|
||||
mono_counters_register ("WBarrier generic store called", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_generic_store);
|
||||
mono_counters_register ("WBarrier generic atomic store called", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_generic_store_atomic);
|
||||
mono_counters_register ("WBarrier set root", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_set_root);
|
||||
mono_counters_register ("WBarrier value copy", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_value_copy);
|
||||
mono_counters_register ("WBarrier object copy", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wbarrier_object_copy);
|
||||
mono_counters_register ("WBarrier remember pointer", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_add_to_global_remset);
|
||||
mono_counters_register ("WBarrier set field", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_set_field);
|
||||
mono_counters_register ("WBarrier set arrayref", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_set_arrayref);
|
||||
mono_counters_register ("WBarrier arrayref copy", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_arrayref_copy);
|
||||
mono_counters_register ("WBarrier generic store called", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_generic_store);
|
||||
mono_counters_register ("WBarrier generic atomic store called", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_generic_store_atomic);
|
||||
mono_counters_register ("WBarrier set root", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_set_root);
|
||||
mono_counters_register ("WBarrier value copy", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_value_copy);
|
||||
mono_counters_register ("WBarrier object copy", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_wbarrier_object_copy);
|
||||
|
||||
mono_counters_register ("# objects allocated degraded", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_objects_alloced_degraded);
|
||||
mono_counters_register ("bytes allocated degraded", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_bytes_alloced_degraded);
|
||||
@@ -3271,7 +3270,7 @@ mono_gc_base_init (void)
|
||||
double allowance_ratio = 0, save_target = 0;
|
||||
gboolean cement_enabled = TRUE;
|
||||
|
||||
mono_counters_init ();
|
||||
sgen_client_init_early ();
|
||||
|
||||
do {
|
||||
result = InterlockedCompareExchange (&gc_initialized, -1, 0);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#ifdef HAVE_SGEN_GC
|
||||
|
||||
#include "metadata/sgen-gc.h"
|
||||
#include "utils/mono-counters.h"
|
||||
#include "sgen-protocol.h"
|
||||
|
||||
#ifdef HEAVY_STATISTICS
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <mono/metadata/sgen-gc.h>
|
||||
#include <mono/metadata/sgen-hash-table.h>
|
||||
#include <mono/utils/mono-counters.h>
|
||||
|
||||
#ifdef HEAVY_STATISTICS
|
||||
static guint64 stat_lookups;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#ifdef HAVE_SGEN_GC
|
||||
|
||||
#include "utils/mono-counters.h"
|
||||
#include "metadata/sgen-gc.h"
|
||||
#include "utils/mono-mmap.h"
|
||||
#include "utils/lock-free-alloc.h"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "utils/mono-counters.h"
|
||||
#include "utils/mono-semaphore.h"
|
||||
#include "utils/mono-time.h"
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#include "metadata/sgen-memory-governor.h"
|
||||
#include "metadata/sgen-thread-pool.h"
|
||||
#include "metadata/mono-gc.h"
|
||||
#include "metadata/sgen-client.h"
|
||||
|
||||
#include "utils/mono-counters.h"
|
||||
#include "utils/mono-mmap.h"
|
||||
#include "utils/mono-logger-internal.h"
|
||||
|
||||
@@ -334,7 +334,7 @@ sgen_memgov_try_alloc_space (mword size, int space)
|
||||
}
|
||||
|
||||
SGEN_ATOMIC_ADD_P (allocated_heap, size);
|
||||
mono_runtime_resource_check_limit (MONO_RESOURCE_GC_HEAP, allocated_heap);
|
||||
sgen_client_total_allocated_heap (allocated_heap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1989,6 +1989,12 @@ sgen_thread_detach (SgenThreadInfo *p)
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
void
|
||||
sgen_client_total_allocated_heap (mword allocated_heap)
|
||||
{
|
||||
mono_runtime_resource_check_limit (MONO_RESOURCE_GC_HEAP, allocated_heap);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mono_gc_user_markers_supported (void)
|
||||
{
|
||||
@@ -2104,6 +2110,12 @@ sgen_client_vtable_get_name (GCVTable *gc_vtable)
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
void
|
||||
sgen_client_init_early (void)
|
||||
{
|
||||
mono_counters_init ();
|
||||
}
|
||||
|
||||
void
|
||||
sgen_client_init (void)
|
||||
{
|
||||
|
||||
@@ -93,16 +93,16 @@ size_t sgen_space_bitmap_size;
|
||||
|
||||
#ifdef HEAVY_STATISTICS
|
||||
|
||||
static gint32 stat_wasted_bytes_trailer = 0;
|
||||
static gint32 stat_wasted_bytes_small_areas = 0;
|
||||
static gint32 stat_wasted_bytes_discarded_fragments = 0;
|
||||
static gint32 stat_nursery_alloc_requests = 0;
|
||||
static gint32 stat_alloc_iterations = 0;
|
||||
static gint32 stat_alloc_retries = 0;
|
||||
static mword stat_wasted_bytes_trailer = 0;
|
||||
static mword stat_wasted_bytes_small_areas = 0;
|
||||
static mword stat_wasted_bytes_discarded_fragments = 0;
|
||||
static guint64 stat_nursery_alloc_requests = 0;
|
||||
static guint64 stat_alloc_iterations = 0;
|
||||
static guint64 stat_alloc_retries = 0;
|
||||
|
||||
static gint32 stat_nursery_alloc_range_requests = 0;
|
||||
static gint32 stat_alloc_range_iterations = 0;
|
||||
static gint32 stat_alloc_range_retries = 0;
|
||||
static guint64 stat_nursery_alloc_range_requests = 0;
|
||||
static guint64 stat_alloc_range_iterations = 0;
|
||||
static guint64 stat_alloc_range_retries = 0;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -871,17 +871,17 @@ sgen_nursery_alloc_range (size_t desired_size, size_t minimum_size, size_t *out_
|
||||
void
|
||||
sgen_nursery_allocator_init_heavy_stats (void)
|
||||
{
|
||||
mono_counters_register ("bytes wasted trailer fragments", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wasted_bytes_trailer);
|
||||
mono_counters_register ("bytes wasted small areas", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wasted_bytes_small_areas);
|
||||
mono_counters_register ("bytes wasted discarded fragments", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_wasted_bytes_discarded_fragments);
|
||||
mono_counters_register ("bytes wasted trailer fragments", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES, &stat_wasted_bytes_trailer);
|
||||
mono_counters_register ("bytes wasted small areas", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES, &stat_wasted_bytes_small_areas);
|
||||
mono_counters_register ("bytes wasted discarded fragments", MONO_COUNTER_GC | MONO_COUNTER_WORD | MONO_COUNTER_BYTES, &stat_wasted_bytes_discarded_fragments);
|
||||
|
||||
mono_counters_register ("# nursery alloc requests", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_nursery_alloc_requests);
|
||||
mono_counters_register ("# nursery alloc iterations", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_alloc_iterations);
|
||||
mono_counters_register ("# nursery alloc retries", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_alloc_retries);
|
||||
mono_counters_register ("# nursery alloc requests", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_nursery_alloc_requests);
|
||||
mono_counters_register ("# nursery alloc iterations", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_alloc_iterations);
|
||||
mono_counters_register ("# nursery alloc retries", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_alloc_retries);
|
||||
|
||||
mono_counters_register ("# nursery alloc range requests", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_nursery_alloc_range_requests);
|
||||
mono_counters_register ("# nursery alloc range iterations", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_alloc_range_iterations);
|
||||
mono_counters_register ("# nursery alloc range restries", MONO_COUNTER_GC | MONO_COUNTER_INT, &stat_alloc_range_retries);
|
||||
mono_counters_register ("# nursery alloc range requests", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_nursery_alloc_range_requests);
|
||||
mono_counters_register ("# nursery alloc range iterations", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_alloc_range_iterations);
|
||||
mono_counters_register ("# nursery alloc range restries", MONO_COUNTER_GC | MONO_COUNTER_ULONG, &stat_alloc_range_retries);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "metadata/profiler-private.h"
|
||||
#include "metadata/sgen-client.h"
|
||||
#include "utils/mono-time.h"
|
||||
#include "utils/mono-counters.h"
|
||||
#include "utils/mono-threads.h"
|
||||
|
||||
#define TV_DECLARE SGEN_TV_DECLARE
|
||||
#define TV_GETTIME SGEN_TV_GETTIME
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "metadata/sgen-workers.h"
|
||||
#include "metadata/sgen-thread-pool.h"
|
||||
#include "utils/mono-counters.h"
|
||||
#include "metadata/sgen-client.h"
|
||||
|
||||
static int workers_num;
|
||||
static WorkerData *workers_data;
|
||||
|
||||
Reference in new issue
Block a user