client/boomerang-rt.js
function() {
		var res, k, urls, url, startTime, data;

		function trimTiming(time, st) {
			// strip from microseconds to milliseconds only
			var timeMs = Math.round(time ? time : 0),
			    startTimeMs = Math.round(st ? st : 0);

			timeMs = (timeMs === 0 ? 0 : (timeMs - startTimeMs));

			return timeMs ? timeMs : "";
		}

		if(BOOMR.t_start) {
			// How long does it take Boomerang to load up and execute (fb to lb)?
			BOOMR.plugins.RT.startTimer("boomerang", BOOMR.t_start);
			BOOMR.plugins.RT.endTimer("boomerang", BOOMR.t_end);	// t_end === null defaults to current time

			// How long did it take from page request to boomerang fb?
			BOOMR.plugins.RT.endTimer("boomr_fb", BOOMR.t_start);

			if(BOOMR.t_lstart) {
				// when did the boomerang loader start loading boomerang on the page?
				BOOMR.plugins.RT.endTimer("boomr_ld", BOOMR.t_lstart);
				// What was the network latency for boomerang (request to first byte)?
				BOOMR.plugins.RT.setTimer("boomr_lat", BOOMR.t_start - BOOMR.t_lstart);
			}
		}

		// use window and not w because we want the inner iframe
		try
		{
			if (window.performance && window.performance.getEntriesByName) {
				urls = { "rt.bmr": BOOMR.url };

				for(url in urls) {
					if(urls.hasOwnProperty(url) && urls[url]) {
						res = window.performance.getEntriesByName(urls[url]);
						if(!res || res.length === 0) {
							continue;
						}
						res = res[0];

						startTime = trimTiming(res.startTime, 0);
						data = [
							startTime,
							trimTiming(res.responseEnd, startTime),
							trimTiming(res.responseStart, startTime),
							trimTiming(res.requestStart, startTime),
							trimTiming(res.connectEnd, startTime),
							trimTiming(res.secureConnectionStart, startTime),
							trimTiming(res.connectStart, startTime),
							trimTiming(res.domainLookupEnd, startTime),
							trimTiming(res.domainLookupStart, startTime),
							trimTiming(res.redirectEnd, startTime),
							trimTiming(res.redirectStart, startTime)
						].join(",").replace(/,+$/, "");

						BOOMR.addVar(url, data);
						impl.addedVars.push(url);
					}
				}
			}
		}
		catch(e)
		{
			BOOMR.addError(e, "rt.getBoomerangTimings");
		}
	}
function() {
		var res, k, urls, url, startTime, data;

		function trimTiming(time, st) {
			// strip from microseconds to milliseconds only
			var timeMs = Math.round(time ? time : 0),
			    startTimeMs = Math.round(st ? st : 0);

			timeMs = (timeMs === 0 ? 0 : (timeMs - startTimeMs));

			return timeMs ? timeMs : "";
		}

		if(BOOMR.t_start) {
			// How long does it take Boomerang to load up and execute (fb to lb)?
			BOOMR.plugins.RT.startTimer("boomerang", BOOMR.t_start);
			BOOMR.plugins.RT.endTimer("boomerang", BOOMR.t_end);	// t_end === null defaults to current time

			// How long did it take from page request to boomerang fb?
			BOOMR.plugins.RT.endTimer("boomr_fb", BOOMR.t_start);

			if(BOOMR.t_lstart) {
				// when did the boomerang loader start loading boomerang on the page?
				BOOMR.plugins.RT.endTimer("boomr_ld", BOOMR.t_lstart);
				// What was the network latency for boomerang (request to first byte)?
				BOOMR.plugins.RT.setTimer("boomr_lat", BOOMR.t_start - BOOMR.t_lstart);
			}
		}

		// use window and not w because we want the inner iframe
		try
		{
			if (window.performance && window.performance.getEntriesByName) {
				urls = { "rt.bmr": BOOMR.url };

				for(url in urls) {
					if(urls.hasOwnProperty(url) && urls[url]) {
						res = window.performance.getEntriesByName(urls[url]);
						if(!res || res.length === 0) {
							continue;
						}
						res = res[0];

						startTime = trimTiming(res.startTime, 0);
						data = [
							startTime,
							trimTiming(res.responseEnd, startTime),
							trimTiming(res.responseStart, startTime),
							trimTiming(res.requestStart, startTime),
							trimTiming(res.connectEnd, startTime),
							trimTiming(res.secureConnectionStart, startTime),
							trimTiming(res.connectStart, startTime),
							trimTiming(res.domainLookupEnd, startTime),
							trimTiming(res.domainLookupStart, startTime),
							trimTiming(res.redirectEnd, startTime),
							trimTiming(res.redirectStart, startTime)
						].join(",").replace(/,+$/, "");

						BOOMR.addVar(url, data);
						impl.addedVars.push(url);
					}
				}
			}
		}
		catch(e)
		{
			BOOMR.addError(e, "rt.getBoomerangTimings");
		}
	}
function ( ) { var res , k , urls , url , startTime , data ; function trimTiming ( time , st ) { // strip from microseconds to milliseconds only var timeMs = Math . round ( time ? time : 0 ) , startTimeMs = Math . round ( st ? st : 0 ) ; timeMs = ( timeMs === 0 ? 0 : ( timeMs - startTimeMs ) ) ; return timeMs ? timeMs : "" ; } if ( BOOMR . t_start ) { // How long does it take Boomerang to load up and execute (fb to lb)? BOOMR . plugins . RT . startTimer ( "boomerang" , BOOMR . t_start ) ; BOOMR . plugins . RT . endTimer ( "boomerang" , BOOMR . t_end ) ; // t_end === null defaults to current time // How long did it take from page request to boomerang fb? BOOMR . plugins . RT . endTimer ( "boomr_fb" , BOOMR . t_start ) ; if ( BOOMR . t_lstart ) { // when did the boomerang loader start loading boomerang on the page? BOOMR . plugins . RT . endTimer ( "boomr_ld" , BOOMR . t_lstart ) ; // What was the network latency for boomerang (request to first byte)? BOOMR . plugins . RT . setTimer ( "boomr_lat" , BOOMR . t_start - BOOMR . t_lstart ) ; } } // use window and not w because we want the inner iframe try { if ( window . performance && window . performance . getEntriesByName ) { urls = { "rt.bmr" : BOOMR . url } ; for ( url in urls ) { if ( urls . hasOwnProperty ( url ) && urls [ url ] ) { res = window . performance . getEntriesByName ( urls [ url ] ) ; if ( ! res || res . length === 0 ) { continue ; } res = res [ 0 ] ; startTime = trimTiming ( res . startTime , 0 ) ; data = [ startTime , trimTiming ( res . responseEnd , startTime ) , trimTiming ( res . responseStart , startTime ) , trimTiming ( res . requestStart , startTime ) , trimTiming ( res . connectEnd , startTime ) , trimTiming ( res . secureConnectionStart , startTime ) , trimTiming ( res . connectStart , startTime ) , trimTiming ( res . domainLookupEnd , startTime ) , trimTiming ( res . domainLookupStart , startTime ) , trimTiming ( res . redirectEnd , startTime ) , trimTiming ( res . redirectStart , startTime ) ] . join ( "," ) . replace ( / ,+$ / , "" ) ; BOOMR . addVar ( url , data ) ; impl . addedVars . push ( url ) ; } } } } catch ( e ) { BOOMR . addError ( e , "rt.getBoomerangTimings" ) ; } }
Figure out how long boomerang and config.js took to load using resource timing if available, or built in timestamps
Figure out how long boomerang and config . js took to load using resource timing if available or built in timestamps