Skip to content

Commit

Permalink
Make heap snapshots aware of multiple threads.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Mar 16, 2016
1 parent 1327f65 commit 5486585
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/profiler/heapsnapshot.c
Expand Up @@ -169,16 +169,31 @@ static void process_workitems(MVMThreadContext *tc, MVMHeapSnapshotState *ss) {
* MVM_gc_worklist_add_frame(tc, worklist, tc->cur_frame);
*/
break;
case MVM_SNAPSHOT_COL_KIND_ROOT:
case MVM_SNAPSHOT_COL_KIND_ROOT: {
MVMThread *cur_thread;

add_reference_const_cstr(tc, ss, "Permanent Roots",
push_workitem(tc, ss, MVM_SNAPSHOT_COL_KIND_PERM_ROOTS, NULL));
add_reference_const_cstr(tc, ss, "VM Instance Roots",
push_workitem(tc, ss, MVM_SNAPSHOT_COL_KIND_INSTANCE_ROOTS, NULL));
add_reference_const_cstr(tc, ss, "C Stack Roots",
push_workitem(tc, ss, MVM_SNAPSHOT_COL_KIND_CSTACK_ROOTS, NULL));
add_reference_const_cstr(tc, ss, "Thread Roots",
push_workitem(tc, ss, MVM_SNAPSHOT_COL_KIND_THREAD_ROOTS, NULL));
break;

cur_thread = tc->instance->threads;
while (cur_thread) {
if (cur_thread->body.tc) {
add_reference_const_cstr(tc, ss, "C Stack Roots",
push_workitem(tc, ss,
MVM_SNAPSHOT_COL_KIND_CSTACK_ROOTS,
cur_thread->body.tc));
add_reference_const_cstr(tc, ss, "Thread Roots",
push_workitem(tc, ss,
MVM_SNAPSHOT_COL_KIND_THREAD_ROOTS,
cur_thread->body.tc));
}
cur_thread = cur_thread->body.next;
}

break;
}
default:
MVM_panic(1, "Unknown heap snapshot worklist item kind %d", item.kind);
}
Expand Down

0 comments on commit 5486585

Please sign in to comment.