Skip to content

Commit

Permalink
expose thread's parent thread id in profile
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Oct 29, 2018
1 parent 85187ce commit 8d4d1e7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/vm/moar/HLL/Backend.nqp
Expand Up @@ -371,8 +371,8 @@ class HLL::Backend::MoarVM {
}
for $obj -> $thread {
my $thisprof := nqp::list;
$thisprof[3] := "NULL";
$thisprof[4] := ~$thread<start_time>;
$thisprof[4] := "NULL";
$thisprof[5] := ~$thread<start_time>;
for $thread -> $k {
my $v := $thread{$k};
if $k eq 'total_time' {
Expand All @@ -395,9 +395,12 @@ class HLL::Backend::MoarVM {
nqp::push_s($pieces, nqp::join(',', @g) ~ ");\n");
}
}
elsif $k eq 'parent' {
$thisprof[3] := ~$v;
}
elsif $k eq 'call_graph' {
my %call_rec_depth;
$thisprof[3] := ~$node_id;
$thisprof[4] := ~$node_id;
sub collect_calls(str $parent_id, %call_graph) {
my str $call_id := ~$node_id;
$node_id++;
Expand Down Expand Up @@ -502,7 +505,7 @@ class HLL::Backend::MoarVM {
$profile_fh.say('CREATE TABLE routines(id INTEGER PRIMARY KEY ASC, name TEXT, line INT, file TEXT);');
$profile_fh.say('CREATE TABLE gcs(time INT, retained_bytes INT, promoted_bytes INT, gen2_roots INT, full INT, responsible INT, cleared_bytes INT, start_time INT, sequence_num INT, thread_id INT);');
$profile_fh.say('CREATE TABLE calls(id INTEGER PRIMARY KEY ASC, parent_id INT, routine_id INT, osr INT, spesh_entries INT, jit_entries INT, inlined_entries INT, inclusive_time INT, exclusive_time INT, entries INT, deopt_one INT, deopt_all INT, rec_depth INT, first_entry_time INT, FOREIGN KEY(routine_id) REFERENCES routines(id));');
$profile_fh.say('CREATE TABLE profile(total_time INT, spesh_time INT, thread_id INT, root_node INT, first_entry_time INT, FOREIGN KEY(root_node) REFERENCES calls(id));');
$profile_fh.say('CREATE TABLE profile(total_time INT, spesh_time INT, thread_id INT, parent_thread_id INT, root_node INT, first_entry_time INT, FOREIGN KEY(root_node) REFERENCES calls(id));');
$profile_fh.say('CREATE TABLE allocations(call_id INT, type_id INT, spesh INT, jit INT, count INT, PRIMARY KEY(call_id, type_id), FOREIGN KEY(call_id) REFERENCES calls(id), FOREIGN KEY(type_id) REFERENCES types(id));');
to_sql($data);
$profile_fh.say('END;');
Expand Down

0 comments on commit 8d4d1e7

Please sign in to comment.