Fix performance measurements for onLoad.

Performance measurements need to be collected after the onLoad event
finishes to get the correct time for the onLoad event.
Remove usage of global object.
Merge pull request #409 from wawe/fix-onload-timing

Fix performance measurements for onLoad.