diff --git a/src/profiler/instrument.c b/src/profiler/instrument.c index bac1888df0..274dc32ef9 100644 --- a/src/profiler/instrument.c +++ b/src/profiler/instrument.c @@ -315,6 +315,7 @@ typedef struct { MVMString *gcs; MVMString *time; MVMString *full; + MVMString *sequence; MVMString *responsible; MVMString *cleared_bytes; MVMString *retained_bytes; @@ -486,6 +487,8 @@ static MVMObject * dump_thread_data(MVMThreadContext *tc, ProfDumpStrs *pds, box_i(tc, ptd->gcs[i].time / 1000)); MVM_repr_bind_key_o(tc, gc_hash, pds->full, box_i(tc, ptd->gcs[i].full)); + MVM_repr_bind_key_o(tc, gc_hash, pds->sequence, + box_i(tc, ptd->gcs[i].gc_seq_num)); MVM_repr_bind_key_o(tc, gc_hash, pds->responsible, box_i(tc, ptd->gcs[i].responsible)); MVM_repr_bind_key_o(tc, gc_hash, pds->cleared_bytes, @@ -544,6 +547,7 @@ void MVM_profile_dump_instrumented_data(MVMThreadContext *tc) { pds.gcs = str(tc, "gcs"); pds.time = str(tc, "time"); pds.full = str(tc, "full"); + pds.sequence = str(tc, "sequence"); pds.responsible = str(tc, "responsible"); pds.cleared_bytes = str(tc, "cleared_bytes"); pds.retained_bytes = str(tc, "retained_bytes"); diff --git a/src/profiler/log.c b/src/profiler/log.c index 094e78b19d..4041cad9a0 100644 --- a/src/profiler/log.c +++ b/src/profiler/log.c @@ -295,6 +295,7 @@ void MVM_profiler_log_gc_start(MVMThreadContext *tc, MVMuint32 full, MVMuint32 t gc->cleared_bytes = (char *)tc->nursery_alloc - (char *)tc->nursery_tospace; gc->responsible = this_thread_responsible; + gc->gc_seq_num = MVM_load(&tc->instance->gc_seq_number); /* Record start time. */ ptd->cur_gc_start_time = uv_hrtime(); diff --git a/src/profiler/log.h b/src/profiler/log.h index 4d31e70ae1..16336fee0b 100644 --- a/src/profiler/log.h +++ b/src/profiler/log.h @@ -50,6 +50,11 @@ struct MVMProfileGC { /* Was this thread responsible? */ MVMuint16 responsible; + /* Which GC run does this belong to? + * (Good to know in multithreaded situations where + * some threads have their work stolen) */ + AO_t gc_seq_num; + /* Nursery statistics. */ MVMuint32 cleared_bytes; MVMuint32 retained_bytes;