Skip to content

Instantly share code, notes, and snippets.

@iksose
Forked from stefanjudis/detailedMetrics.js
Created April 12, 2014 18:56
Show Gist options
  • Save iksose/10550946 to your computer and use it in GitHub Desktop.
Save iksose/10550946 to your computer and use it in GitHub Desktop.
javascript:( function() {
console.group( 'Performance Information for all entries of ' + window.location.href );
console.log( '\n-> Duration is displayed in ms\n ' )
var entries = window.performance.getEntries();
entries = entries.sort( function( a, b ) {
return b.duration - a.duration;
} );
console.table(
entries, [ 'name', 'duration' ]
);
console.groupEnd();
})();
javascript:( function() {
console.group( 'Performance Information for ' + window.location.href );
console.log( '\n-> Time is displayed in ms\n ' );
var timing = window.performance.timing;
var metrics = {
'Time for DNS lookup' : {
time : timing.domainLookupEnd - timing.domainLookupStart
},
'Time for Connecting' : {
time : timing.connectEnd - timing.connectStart
},
'Time for Receiving' : {
time : timing.responseEnd - timing.responseStart
},
'Time to document "DOMContentLoaded" event' : {
time : timing.domContentLoadedEventEnd - timing.navigationStart
},
'Time to document "load" event' : {
time : timing.loadEventEnd - timing.navigationStart
}
};
console.table(
metrics, [ 'time' ]
);
console.groupEnd();
} )()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment