Skip to content

Instantly share code, notes, and snippets.

@gnclmorais
Forked from stefanjudis/detailedMetrics.js
Created November 11, 2013 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnclmorais/7415595 to your computer and use it in GitHub Desktop.
Save gnclmorais/7415595 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