Class DefaultPerformanceTimingMetrics
- java.lang.Object
-
- org.fluentlenium.core.performance.DefaultPerformanceTimingMetrics
-
- All Implemented Interfaces:
PerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
public class DefaultPerformanceTimingMetrics extends java.lang.Object implements PerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
Default implementation ofPerformanceTimingMetrics
storing the metrics value as aMap
.It also provides an option to convert all values in the current object to an arbitrary
TimeUnit
. For that you can callin(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 return1sec
for that instead of rounding it up to2sec
.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:
DefaultPerformanceTiming
-
-
Constructor Summary
Constructors Modifier Constructor Description DefaultPerformanceTimingMetrics(java.util.Map<java.lang.String,java.lang.Object> timingMetrics)
Creates a newDefaultPerformanceTimingMetrics
object from the argument epoch values.protected
DefaultPerformanceTimingMetrics(java.util.Map<java.lang.String,java.lang.Object> timingMetrics, java.util.concurrent.TimeUnit timeUnit)
Creates a newDefaultPerformanceTimingMetrics
object from the argument metrics (in the given time unit).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>
getAllMetrics()
long
getConnectEnd()
long
getConnectStart()
long
getDomainLookupEnd()
long
getDomainLookupStart()
long
getDomComplete()
long
getDomContentLoadedEventEnd()
long
getDomContentLoadedEventStart()
long
getDomInteractive()
long
getDomLoading()
long
getFetchStart()
long
getLoadEventEnd()
long
getLoadEventStart()
long
getNavigationStart()
long
getRedirectEnd()
long
getRedirectStart()
long
getRequestStart()
long
getResponseEnd()
long
getResponseStart()
java.lang.Object
getSecureConnectionStart()
According to the official documentation of the secureConnectionStart attribute this attribute is optional and may be set asundefined
.java.util.concurrent.TimeUnit
getSourceTimeUnit()
long
getUnloadEventEnd()
long
getUnloadEventStart()
DefaultPerformanceTimingMetrics
in(java.util.concurrent.TimeUnit targetTimeUnit)
Returns a new metrics object having all metric values converted to the targetTimeUnit
.
-
-
-
Constructor Detail
-
DefaultPerformanceTimingMetrics
public DefaultPerformanceTimingMetrics(java.util.Map<java.lang.String,java.lang.Object> timingMetrics)
Creates a newDefaultPerformanceTimingMetrics
object 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
protected DefaultPerformanceTimingMetrics(java.util.Map<java.lang.String,java.lang.Object> timingMetrics, java.util.concurrent.TimeUnit timeUnit)
Creates a newDefaultPerformanceTimingMetrics
object from the argument metrics (in the given time unit).- Parameters:
timingMetrics
- the metricstimeUnit
- the time unit of the metrics
-
-
Method Detail
-
in
public DefaultPerformanceTimingMetrics in(java.util.concurrent.TimeUnit targetTimeUnit)
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
long
values, otherwise added to the new metrics object unchanged.- Specified by:
in
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
- Parameters:
targetTimeUnit
- the time unit to convert the metrics to- Returns:
- the converted metrics object
-
getAllMetrics
public java.util.Map<java.lang.String,java.lang.Object> getAllMetrics()
-
getSourceTimeUnit
public java.util.concurrent.TimeUnit getSourceTimeUnit()
-
getUnloadEventStart
public long getUnloadEventStart()
- Specified by:
getUnloadEventStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getUnloadEventEnd
public long getUnloadEventEnd()
- Specified by:
getUnloadEventEnd
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getRedirectStart
public long getRedirectStart()
- Specified by:
getRedirectStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getRedirectEnd
public long getRedirectEnd()
- Specified by:
getRedirectEnd
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getNavigationStart
public long getNavigationStart()
- Specified by:
getNavigationStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getFetchStart
public long getFetchStart()
- Specified by:
getFetchStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomainLookupStart
public long getDomainLookupStart()
- Specified by:
getDomainLookupStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomainLookupEnd
public long getDomainLookupEnd()
- Specified by:
getDomainLookupEnd
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getConnectStart
public long getConnectStart()
- Specified by:
getConnectStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getConnectEnd
public long getConnectEnd()
- Specified by:
getConnectEnd
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getSecureConnectionStart
public java.lang.Object 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<DefaultPerformanceTimingMetrics>
- Returns:
- the metrics value
-
getRequestStart
public long getRequestStart()
- Specified by:
getRequestStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getResponseStart
public long getResponseStart()
- Specified by:
getResponseStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getResponseEnd
public long getResponseEnd()
- Specified by:
getResponseEnd
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomLoading
public long getDomLoading()
- Specified by:
getDomLoading
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomInteractive
public long getDomInteractive()
- Specified by:
getDomInteractive
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomContentLoadedEventStart
public long getDomContentLoadedEventStart()
- Specified by:
getDomContentLoadedEventStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomContentLoadedEventEnd
public long getDomContentLoadedEventEnd()
- Specified by:
getDomContentLoadedEventEnd
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getDomComplete
public long getDomComplete()
- Specified by:
getDomComplete
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getLoadEventStart
public long getLoadEventStart()
- Specified by:
getLoadEventStart
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
getLoadEventEnd
public long getLoadEventEnd()
- Specified by:
getLoadEventEnd
in interfacePerformanceTimingMetrics<DefaultPerformanceTimingMetrics>
-
-