Class DefaultPerformanceTimingMetrics
- All Implemented Interfaces:
PerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
PerformanceTimingMetrics storing the metrics value as a Map.
It also provides an option to convert all values in the current object to an arbitrary TimeUnit.
For that you can call in(TimeUnit) on the current object.
The values returned from this object are not epoch values as querying the corresponding Javascript attribute
directly would return, but it rather handles navigationStart as zero and returns time values passed
since that point in time.
Take into account that when there is a time difference like 1675ms, and it is converted to e.g. seconds,
the conversion will return 1sec for that instead of rounding it up to 2sec.
If a query for a certain metric returns 0 it means it happened at the same moment (at least in epoch)
than navigationStart.
A query for a certain metrics returns a negative value if the event has not been registered on the page, or it is not feasible/valid for the given page/page load/redirect.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDefaultPerformanceTimingMetrics(Map<String, Object> timingMetrics) Creates a newDefaultPerformanceTimingMetricsobject from the argument epoch values.protectedDefaultPerformanceTimingMetrics(Map<String, Object> timingMetrics, TimeUnit timeUnit) Creates a newDefaultPerformanceTimingMetricsobject from the argument metrics (in the given time unit). -
Method Summary
Modifier and TypeMethodDescriptionlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglongAccording to the official documentation of the secureConnectionStart attribute this attribute is optional and may be set asundefined.longlongReturns a new metrics object having all metric values converted to the targetTimeUnit.
-
Constructor Details
-
DefaultPerformanceTimingMetrics
Creates a newDefaultPerformanceTimingMetricsobject from the argument epoch values.It calculates and converts the epoch values into the differences/times passed since
navigationStart.- Parameters:
timingMetrics- the timing metrics in epoch
-
DefaultPerformanceTimingMetrics
Creates a newDefaultPerformanceTimingMetricsobject from the argument metrics (in the given time unit).- Parameters:
timingMetrics- the metricstimeUnit- the time unit of the metrics
-
-
Method Details
-
in
Returns a new metrics object having all metric values converted to the targetTimeUnit.Values that can have other than long values are converted if they are
longvalues, otherwise added to the new metrics object unchanged.- Specified by:
inin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>- Parameters:
targetTimeUnit- the time unit to convert the metrics to- Returns:
- the converted metrics object
-
getAllMetrics
-
getSourceTimeUnit
-
getUnloadEventStart
public long getUnloadEventStart()- Specified by:
getUnloadEventStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getUnloadEventEnd
public long getUnloadEventEnd()- Specified by:
getUnloadEventEndin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getRedirectStart
public long getRedirectStart()- Specified by:
getRedirectStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getRedirectEnd
public long getRedirectEnd()- Specified by:
getRedirectEndin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getFetchStart
public long getFetchStart()- Specified by:
getFetchStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomainLookupStart
public long getDomainLookupStart()- Specified by:
getDomainLookupStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomainLookupEnd
public long getDomainLookupEnd()- Specified by:
getDomainLookupEndin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getConnectStart
public long getConnectStart()- Specified by:
getConnectStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getConnectEnd
public long getConnectEnd()- Specified by:
getConnectEndin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getSecureConnectionStart
Description copied from interface:PerformanceTimingMetricsAccording to the official documentation of the secureConnectionStart attribute this attribute is optional and may be set asundefined.It is up to the user of this method to check whether it is present and convert it accordingly.
- Specified by:
getSecureConnectionStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>- Returns:
- the metrics value
-
getRequestStart
public long getRequestStart()- Specified by:
getRequestStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getResponseStart
public long getResponseStart()- Specified by:
getResponseStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getResponseEnd
public long getResponseEnd()- Specified by:
getResponseEndin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomLoading
public long getDomLoading()- Specified by:
getDomLoadingin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomInteractive
public long getDomInteractive()- Specified by:
getDomInteractivein interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomContentLoadedEventStart
public long getDomContentLoadedEventStart()- Specified by:
getDomContentLoadedEventStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomContentLoadedEventEnd
public long getDomContentLoadedEventEnd()- Specified by:
getDomContentLoadedEventEndin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomComplete
public long getDomComplete()- Specified by:
getDomCompletein interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getLoadEventStart
public long getLoadEventStart()- Specified by:
getLoadEventStartin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getLoadEventEnd
public long getLoadEventEnd()- Specified by:
getLoadEventEndin interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-