Class: SurfNPerf

SurfNPerf

new SurfNPerf()

Frontend Web Performance Data Gathering

Methods

staticSurfNPerf.SNPProto.clearMarks(eventKey)

Removes all user-set marks (or just the specified one) and their associated time values. Will not remove the loadEventEnd mark.

Name Type Description
eventKey String optional

removes all time values for the given eventKey

staticSurfNPerf.SNPProto.duration(startMark, endMark){Number}

Returns the duration between two marks

Name Type Description
startMark String

name of the first mark

endMark String optional

optional name of the second mark

Returns:
Type Description
Number duration between the two specified marks. If the endMark is not specified, returns the duration between the startMark and the current time

staticSurfNPerf.SNPProto.getFirstPaint(){integer}

Time to first paint (browser-reported time for the first pixels to be rendered on the page)

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getFirstPaintFrame(){integer}

Time to first paint (Time calculated based on window.requestAnimationFrame() for the first pixels to be rendered on the page)

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getFullRequestLoadTime(){integer}

Total time for a page to load from the time the user initiates the access of the page to the firing of the onLoad event

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getHiddenTime(){integer}

Total time a page is not visible, as reported by the Page Visibility API

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getNetworkLatency(){integer}

Total time for App Cache, DNS, TCP, Request & Response

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getNetworkTime(){integer}

Total time for App Cache, DNS & TCP

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getProcessingLoadTime(){integer}

Total time to process the Response & fire the onLoad event

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getServerTime(){integer}

Total time for Request & Response

Returns:
Type Description
integer time in ms

staticSurfNPerf.SNPProto.getTimingMark(eventKey, timeType){DOMHighResTimeStamp|integer}

Returns the timing data for a particular eventKey

Name Type Description
eventKey String

name of the timing event

timeType String

'highRes' (to return a DOMHighResTimeStamp, if available) or 'DOM' (to return a DOMTimeStamp's value) - optional. Defaults to 'DOM'

Returns:
Type Description
DOMHighResTimeStamp | integer time value

staticSurfNPerf.SNPProto.isHidden(){boolean}

Is the page hidden or not, as reported by the Page Visibility API

Returns:
Type Description
boolean true if the page is in a state considered to be hidden to the user, and false otherwise.

staticSurfNPerf.SNPProto.markNow(){String}

Marks the current time

Returns:
Type Description
String name generated for the mark

staticSurfNPerf.SNPProto.now(timeType){DOMHighResTimeStamp|integer}

Returns the timing data for a particular eventKey

Name Type Description
timeType String

'highRes' (to return a DOMHighResTimeStamp, if available) or 'DOM' (to return a DOMTimeStamp's value) - optional. Defaults to 'highRes'

Returns:
Type Description
DOMHighResTimeStamp | integer time value