show peak code bytes in GC logging output

This commit is contained in:
Matthew Flatt 2019-01-25 15:39:36 -07:00
parent bd6cf17f92
commit 13cb9bfc06
2 changed files with 14 additions and 6 deletions

View File

@ -314,6 +314,7 @@ typedef struct Thread_Local_Variables {
intptr_t scheme_code_total_;
intptr_t scheme_code_count_;
intptr_t max_gc_pre_used_bytes_;
intptr_t max_code_page_total_;
int num_major_garbage_collections_;
int num_minor_garbage_collections_;
int locale_on_;
@ -696,6 +697,7 @@ XFORM_GC_VARIABLE_STACK_THROUGH_THREAD_LOCAL;
#define scheme_code_total XOA (scheme_get_thread_local_variables()->scheme_code_total_)
#define scheme_code_count XOA (scheme_get_thread_local_variables()->scheme_code_count_)
#define max_gc_pre_used_bytes XOA (scheme_get_thread_local_variables()->max_gc_pre_used_bytes_)
#define max_code_page_total XOA (scheme_get_thread_local_variables()->max_code_page_total_)
#define num_major_garbage_collections XOA (scheme_get_thread_local_variables()->num_major_garbage_collections_)
#define num_minor_garbage_collections XOA (scheme_get_thread_local_variables()->num_minor_garbage_collections_)
#define locale_on XOA (scheme_get_thread_local_variables()->locale_on_)

View File

@ -105,6 +105,7 @@ THREAD_LOCAL_DECL(int scheme_did_gc_count);
THREAD_LOCAL_DECL(static intptr_t process_time_at_swap);
THREAD_LOCAL_DECL(static intptr_t max_gc_pre_used_bytes);
THREAD_LOCAL_DECL(static intptr_t max_code_page_used_bytes);
#ifdef MZ_PRECISE_GC
THREAD_LOCAL_DECL(static int num_major_garbage_collections);
THREAD_LOCAL_DECL(static int num_minor_garbage_collections);
@ -9331,10 +9332,13 @@ static void inform_GC(int master_gc, int major_gc, int inc_gc,
{
Scheme_Logger *logger;
if (!master_gc
&& (pre_used > max_gc_pre_used_bytes)
&& (max_gc_pre_used_bytes >= 0))
max_gc_pre_used_bytes = pre_used;
if (!master_gc) {
if ((pre_used > max_gc_pre_used_bytes)
&& (max_gc_pre_used_bytes >= 0))
max_gc_pre_used_bytes = pre_used;
if (scheme_code_page_total > max_code_page_total)
max_code_page_total = scheme_code_page_total;
}
if (major_gc)
num_major_garbage_collections++;
@ -9416,7 +9420,7 @@ static void log_peak_memory_use()
if (max_gc_pre_used_bytes > 0) {
logger = scheme_get_gc_logger();
if (logger && scheme_log_level_p(logger, SCHEME_LOG_INFO)) {
char buf[256], nums[128], *num, *numt, *num2;
char buf[256], nums[128], *num, *numc, *numt, *num2;
intptr_t buflen, allocated_bytes;
#ifdef MZ_PRECISE_GC
allocated_bytes = GC_get_memory_ever_allocated();
@ -9425,14 +9429,16 @@ static void log_peak_memory_use()
#endif
memset(nums, 0, sizeof(nums));
num = gc_num(nums, max_gc_pre_used_bytes);
numc = gc_num(nums, max_code_page_total);
numt = gc_num(nums, allocated_bytes);
num2 = gc_unscaled_num(nums, scheme_total_gc_time);
sprintf(buf,
"" PLACE_ID_FORMAT "atexit peak %sK; alloc %sK; major %d; minor %d; %sms",
"" PLACE_ID_FORMAT "atexit peak %sK[+%sK]; alloc %sK; major %d; minor %d; %sms",
#ifdef MZ_USE_PLACES
scheme_current_place_id,
#endif
num,
numc,
numt,
num_major_garbage_collections,
num_minor_garbage_collections,