The strace option should be doable. Terminal & timer a bit more work.
So long as the print statements come between other blocks of code, though, I'd look at strace (or dtrace, gdb, etc.).
Assuming Linux/Unix OS.
Let me know what OS / processes you're working with.
I'm much more a shell hacker than systems programmer but this smells doable.
The strace option should be doable. Terminal & timer a bit more work.
So long as the print statements come between other blocks of code, though, I'd look at strace (or dtrace, gdb, etc.).
Assuming Linux/Unix OS.