example profiler using pthreads to interrupt main thread.
cannot be used in general (only works on 1 short file) but a good starting point for something better.