What Hook to Use to Execute a PHP on Header and Footer in Every Page?
hook_init() is run at the beginning of the page request. So this is where you should start your timer.

hook_exit() is run at the end of most regular page requests. And it's here you should stop your timer.

I did a search on similar modules and found Arooga, maybe you can find some ideas there. Also Devel has functionality to log page execution time, slow queries etc.