So I spent today looking at the old profile module and hotshot. Learned a lot - but not enough yet.
I quite like the idea of Brett to try and stick with hotshot and try to improve that. The main job would then be to write a wrapper to emulate profile and pstats. But I still have to look at the patch in this bug report.