From 22e7e3d8291a5a4d828a728b34d13b2d86475951 Mon Sep 17 00:00:00 2001 From: soulgalore Date: Mon, 23 Jun 2014 21:54:41 +0200 Subject: [PATCH] moved out timing defintions to the util file --- lib/util.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/util.js b/lib/util.js index a6db44013..1076564ee 100644 --- a/lib/util.js +++ b/lib/util.js @@ -292,6 +292,26 @@ module.exports = { return Object.keys(domains).length; }, + getTimingMetricsDefinition: function(timing) { + + var descriptions = {}; + descriptions.firstPaintTime = 'This is when the first paint happens on the screen, reported by the browser.'; + descriptions.serverConnectionTime = 'How long time it takes to connect to the server. Definition: connectEnd - connectStart'; + descriptions.domainLookupTime = 'The time it takes to do the DNS lookup. Definition: domainLookupEnd - domainLookupStart'; + descriptions.pageLoadTime = 'The time it takes for page to load, from initiation of the pageview (e.g., click on a page link) to load completion in the browser. Important: this is only relevant to some pages, depending on how you page is built. Definition: loadEventStart - navigationStart'; + descriptions.pageDownloadTime = 'How long time does it take to download the page (the HTML). Definition: responseEnd - responseStart'; + descriptions.serverResponseTime = 'How long time does it take until the server respond. Definition: responseStart - requestStart'; + descriptions.domContentLoadedTime = "The time the browser takes to parse the document and execute deferred and parser-inserted scripts including the network time from the user's location to your server. Definition: domContentLoadedEventStart - navigationStart"; + descriptions.domInteractiveTime = "The time the browser takes to parse the document, including the network time from the user's location to your server. Definition: domInteractive - navigationStart"; + descriptions.redirectionTime = 'Time spent on redirects. Definition: fetchStart - navigationStart'; + descriptions.backEndTime = 'The time it takes for the network and the server to generate and start sending the HTML. Definition: responseStart - navigationStart'; + descriptions.frontEndTime = 'The time it takes for the browser to parse and create the page. Definition: loadEventStart - responseEnd'; + + if (descriptions.hasOwnProperty(timing)) + return descriptions[timing]; + else return 'Measurement using the User Timing API'; + }, + /** * Get the size in bytes for a specific domain */