Skip to content

Instantly share code, notes, and snippets.

@hustKiwi
Created June 15, 2012 22:26
Show Gist options
  • Save hustKiwi/2938995 to your computer and use it in GitHub Desktop.
Save hustKiwi/2938995 to your computer and use it in GitHub Desktop.
function getPerfStats() {
var timing = window.performance.timing;
return {
dns: timing.domainLookupEnd - timing.domainLookupStart,
connect: timing.connectEnd - timing.connectStart,
ttfb: timing.responseStart - timing.connectEnd,
basePage: timing.responseEnd - timing.responseStart,
frontEnd: timing.loadEventStart - timing.responseEnd
};
}
window.onload = function() {
var stats = getPerfStats();
console.log('stats', stats);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment