perf tools: Refactor code to move call path handling out of thread-stack