Due to performance concerns, we don't account for the space wasted in blocks, since it would require dereferencing all vtables. We also don't account for allocation that might happen during sweep.
}
void
-sgen_client_log_timing (GGTimingInfo *info, mword promoted_size)
+sgen_client_log_timing (GGTimingInfo *info, mword promoted_size, mword major_used_size)
{
SgenMajorCollector *major_collector = sgen_get_major_collector ();
mword num_major_sections = major_collector->get_num_major_sections ();
los_memory_usage_total / 1024,
los_memory_usage / 1024);
else
- mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MINOR%s: (%s) pause %.2fms, %s promoted %dK major %dK los size: %dK in use: %dK",
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MINOR%s: (%s) pause %.2fms, %s promoted %dK major size: %dK in use: %dK los size: %dK in use: %dK",
info->is_overflow ? "_OVERFLOW" : "",
info->reason ? info->reason : "",
(int)info->total_time / 10000.0f,
full_timing_buff,
(int)promoted_size / 1024,
major_collector->section_size * num_major_sections / 1024,
+ major_used_size / 1024,
los_memory_usage_total / 1024,
los_memory_usage / 1024);
}
* Called after collections, reporting the amount of time they took. No action is
* necessary.
*/
-void sgen_client_log_timing (GGTimingInfo *info, mword promoted_size);
+void sgen_client_log_timing (GGTimingInfo *info, mword promoted_size, mword major_used_size);
/*
* Called to handle `MONO_GC_PARAMS` and `MONO_GC_DEBUG` options. The `handle` functions
extern NurseryClearPolicy nursery_clear_policy;
extern gboolean sgen_try_free_some_memory;
extern mword total_promoted_size;
+extern mword total_allocated_major;
extern MonoCoopMutex gc_mutex;
/* FIXME: assumes object layout */
*(GCVTable*)obj = vtable;
+ total_allocated_major += block_obj_sizes [size_index];
+
return (GCObject *)obj;
}
static void
sweep_finish (void)
{
+ mword used_slots_size = 0;
int i;
for (i = 0; i < num_block_obj_sizes; ++i) {
} else {
evacuate_block_obj_sizes [i] = FALSE;
}
+
+ used_slots_size += sweep_slots_used [i] * block_obj_sizes [i];
}
- sgen_memgov_major_post_sweep ();
+ sgen_memgov_major_post_sweep (used_slots_size);
set_sweep_state (SWEEP_STATE_SWEPT, SWEEP_STATE_COMPACTING);
if (concurrent_sweep)
#define MIN_MINOR_COLLECTION_ALLOWANCE ((mword)(DEFAULT_NURSERY_SIZE * default_allowance_nursery_size_ratio))
mword total_promoted_size = 0;
+mword total_allocated_major = 0;
static mword total_promoted_size_start;
+static mword total_allocated_major_end;
/*Heap limits and allocation knobs*/
static mword max_heap_size = ((mword)0)- ((mword)1);
/* The size of the LOS after the last major collection, after sweeping. */
static mword last_collection_los_memory_usage = 0;
+static mword last_used_slots_size = 0;
static mword sgen_memgov_available_free_space (void);
}
void
-sgen_memgov_major_post_sweep (void)
+sgen_memgov_major_post_sweep (mword used_slots_size)
{
mword num_major_sections = major_collector.get_num_major_sections ();
- mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_SWEEP: major %dK",
- num_major_sections * major_collector.section_size / 1024);
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "GC_MAJOR_SWEEP: major size: %dK in use: %dK",
+ num_major_sections * major_collector.section_size / 1024,
+ (used_slots_size + total_allocated_major - total_allocated_major_end) / 1024);
+ last_used_slots_size = used_slots_size;
}
void
{
last_collection_los_memory_usage = los_memory_usage;
+ total_allocated_major_end = total_allocated_major;
if (forced) {
sgen_get_major_collector ()->finish_sweeping ();
sgen_memgov_calculate_minor_collection_allowance ();
int i;
for (i = 0; i < info_count; ++i) {
if (info[i].generation != -1)
- sgen_client_log_timing (&info [i], total_promoted_size - total_promoted_size_start);
+ sgen_client_log_timing (&info [i], total_promoted_size - total_promoted_size_start, last_used_slots_size + total_allocated_major - total_allocated_major_end);
}
}
void sgen_memgov_minor_collection_end (void);
void sgen_memgov_major_pre_sweep (void);
-void sgen_memgov_major_post_sweep (void);
+void sgen_memgov_major_post_sweep (mword used_slots_size);
void sgen_memgov_major_collection_start (void);
void sgen_memgov_major_collection_end (gboolean forced);