Commit ea0a21e1 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add more safepoints if the sampling profiler is on

parent 7596e61a
......@@ -695,6 +695,10 @@ Value ASTInterpreter::visit_yield(AST_Yield* node) {
}
Value ASTInterpreter::visit_stmt(AST_stmt* node) {
#if ENABLE_SAMPLING_PROFILER
threading::allowGLReadPreemption();
#endif
if (0) {
printf("%20s % 2d ", source_info->getName().c_str(), current_block->idx);
print_ast(node);
......
......@@ -2608,6 +2608,13 @@ public:
if (state == DEAD)
break;
assert(state != FINISHED);
#if ENABLE_SAMPLING_PROFILER
auto stmt = block->body[i];
if (stmt->type != AST_TYPE::Assign) // could be a landingpad
doSafePoint(block->body[i]);
#endif
doStmt(block->body[i], UnwindInfo(block->body[i], NULL));
}
if (VERBOSITY("irgenerator") >= 2) { // print ending symbol table
......
......@@ -11,6 +11,9 @@ if __name__ == "__main__":
if cur_traceback:
tracebacks.append(''.join(cur_traceback).strip())
cur_traceback = []
elif not (l.startswith(" File") or l.startswith(" ")):
print "non-traceback line? ", l.strip()
continue
else:
cur_traceback.append(l)
if cur_traceback:
......@@ -22,6 +25,7 @@ if __name__ == "__main__":
# dedupe on:
# key = t # full traceback
# key = '\n'.join(t.split('\n')[-8:]) # last 4 stack frames
# key = '\n'.join(t.split('\n')[-4:]) # last 2 stack frames
# key = '\n'.join(t.split('\n')[-2:]) # last stack frame
key = t.split(' File "')[-1].split()[0][:-2] # filename of last stack trace
counts[key] = counts.get(key, 0) + 1
......@@ -46,4 +50,5 @@ if __name__ == "__main__":
print "Occurs %d (%.1f%%) times:" % (v, 100.0 * v / n)
print k
print
print "Total tracebacks:", n
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment