Class HtmlUnitPerformanceTimingMetrics
- All Implemented Interfaces:
PerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
PerformanceTimingMetrics
.
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.
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.
Though the HtmlUnit PerformanceTiming
class is a mock implementation of the
PerformanceTiming API,
the lack of this adapter might cause issues.
Before retrieving performance timing metrics from HtmlUnit, please check the aforementioned class whether it is still a mock object or meanwhile it has been implemented properly to return real values.
-
Constructor Summary
ConstructorDescriptionHtmlUnitPerformanceTimingMetrics
(com.gargoylesoftware.htmlunit.javascript.host.performance.PerformanceTiming timing) Creates a newHtmlUnitPerformanceTimingMetrics
object delegating calls to the argumentPerformanceTiming
.HtmlUnitPerformanceTimingMetrics
(com.gargoylesoftware.htmlunit.javascript.host.performance.PerformanceTiming timing, TimeUnit timeUnit) Creates a newHtmlUnitPerformanceTimingMetrics
object delegating calls to the argumentPerformanceTiming
. -
Method Summary
Modifier and TypeMethodDescriptionlong
long
long
long
long
long
long
long
long
long
long
long
long
long
long
long
long
long
According to the official documentation of the secureConnectionStart attribute this attribute is optional and may be set asundefined
.long
long
Creates a new metrics object instance that returns the metrics values in the givenTimeUnit
.
-
Constructor Details
-
HtmlUnitPerformanceTimingMetrics
public HtmlUnitPerformanceTimingMetrics(com.gargoylesoftware.htmlunit.javascript.host.performance.PerformanceTiming timing) Creates a newHtmlUnitPerformanceTimingMetrics
object delegating calls to the argumentPerformanceTiming
.Sets the time unit of these metrics to
TimeUnit.MILLISECONDS
.- Parameters:
timing
- the HtmlUnit performance timing object
-
HtmlUnitPerformanceTimingMetrics
public HtmlUnitPerformanceTimingMetrics(com.gargoylesoftware.htmlunit.javascript.host.performance.PerformanceTiming timing, TimeUnit timeUnit) Creates a newHtmlUnitPerformanceTimingMetrics
object delegating calls to the argumentPerformanceTiming
.Sets the time unit of these metrics to the given time unit.
- Parameters:
timing
- the HtmlUnit performance timing objecttimeUnit
- the time unit to convert the metrics to
-
-
Method Details
-
in
Description copied from interface:PerformanceTimingMetrics
Creates a new metrics object instance that returns the metrics values in the givenTimeUnit
.When implementing this method take into account that there may be metric values that don't always return a
long
value but may be undefined, or something else, like thesecureConnectionStart
attribute.- Specified by:
in
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
- Parameters:
targetTimeUnit
- the time unit to return the metrics in- Returns:
- the metrics in the given time unit
-
getUnloadEventStart
public long getUnloadEventStart()- Specified by:
getUnloadEventStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getUnloadEventEnd
public long getUnloadEventEnd()- Specified by:
getUnloadEventEnd
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getRedirectStart
public long getRedirectStart()- Specified by:
getRedirectStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getRedirectEnd
public long getRedirectEnd()- Specified by:
getRedirectEnd
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getFetchStart
public long getFetchStart()- Specified by:
getFetchStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getDomainLookupStart
public long getDomainLookupStart()- Specified by:
getDomainLookupStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getDomainLookupEnd
public long getDomainLookupEnd()- Specified by:
getDomainLookupEnd
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getConnectStart
public long getConnectStart()- Specified by:
getConnectStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getConnectEnd
public long getConnectEnd()- Specified by:
getConnectEnd
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getSecureConnectionStart
Description copied from interface:PerformanceTimingMetrics
According 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:
getSecureConnectionStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
- Returns:
- the metrics value
-
getRequestStart
public long getRequestStart()- Specified by:
getRequestStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getResponseStart
public long getResponseStart()- Specified by:
getResponseStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getResponseEnd
public long getResponseEnd()- Specified by:
getResponseEnd
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getDomLoading
public long getDomLoading()- Specified by:
getDomLoading
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getDomInteractive
public long getDomInteractive()- Specified by:
getDomInteractive
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getDomContentLoadedEventStart
public long getDomContentLoadedEventStart()- Specified by:
getDomContentLoadedEventStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getDomContentLoadedEventEnd
public long getDomContentLoadedEventEnd()- Specified by:
getDomContentLoadedEventEnd
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getDomComplete
public long getDomComplete()- Specified by:
getDomComplete
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getLoadEventStart
public long getLoadEventStart()- Specified by:
getLoadEventStart
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-
getLoadEventEnd
public long getLoadEventEnd()- Specified by:
getLoadEventEnd
in interfacePerformanceTimingMetrics<HtmlUnitPerformanceTimingMetrics>
-