Skip to content

Commit

Permalink
record a gc's sequence number
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Feb 18, 2018
1 parent 0761eaf commit c6d1115
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/profiler/instrument.c
Expand Up @@ -315,6 +315,7 @@ typedef struct {
MVMString *gcs;
MVMString *time;
MVMString *full;
MVMString *sequence;
MVMString *responsible;
MVMString *cleared_bytes;
MVMString *retained_bytes;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/profiler/log.c
Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/profiler/log.h
Expand Up @@ -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;
Expand Down

0 comments on commit c6d1115

Please sign in to comment.