Performance Meters"
From Documentation
Line 5: | Line 5: | ||
[[Image:performancemeter.png]] | [[Image:performancemeter.png]] | ||
− | As | + | As shown above, T1-T5 identifies the following callbacks. |
* T1: <javadoc type="interface" method="requestStartAtClient (java.lang.String, org.zkoss.zk.ui.Execution, long)">org.zkoss.zk.ui.util.PerformanceMeter</javadoc> | * T1: <javadoc type="interface" method="requestStartAtClient (java.lang.String, org.zkoss.zk.ui.Execution, long)">org.zkoss.zk.ui.util.PerformanceMeter</javadoc> | ||
* T2: <javadoc type="interface" method="requestStartAtServer(java.lang.String, org.zkoss.zk.ui.Execution, long)">org.zkoss.zk.ui.util.PerformanceMeter</javadoc> | * T2: <javadoc type="interface" method="requestStartAtServer(java.lang.String, org.zkoss.zk.ui.Execution, long)">org.zkoss.zk.ui.util.PerformanceMeter</javadoc> | ||
Line 18: | Line 18: | ||
* Network Latency Time: (T4 - T3) + (T2 - T1) | * Network Latency Time: (T4 - T3) + (T2 - T1) | ||
− | Notice that, when we make a connection to load a page for the first time, only Server Execution Time is available. T4 and T5 will be saved on the client side | + | Notice that, when we make a connection to load a page for the first time, only Server Execution Time is available. T4 and T5 will be saved on the client-side and sent back along with the next request. |
− | Once implemented, you | + | = Register as a Listener = |
+ | Once implemented, you need to register it as a [[ZK_Configuration_Reference/zk.xml/The_listener_Element| listener]] in <code>WEB-INF/zk.xml</code> (assume the class is called foo.MyMeter): | ||
<source lang="xml"> | <source lang="xml"> | ||
− | |||
<listener> | <listener> | ||
<listener-class>foo.MyMeter</listener-class> | <listener-class>foo.MyMeter</listener-class> | ||
</listener> | </listener> | ||
− | |||
</source> | </source> | ||
Revision as of 07:05, 8 July 2022
PerformanceMeter is a collection of callbacks that the implementation could know when a request is sent, arrives or is is processed.
As shown above, T1-T5 identifies the following callbacks.
- T1: PerformanceMeter.requestStartAtClient (String, Execution, long)
- T2: PerformanceMeter.requestStartAtServer(String, Execution, long)
- T3: PerformanceMeter.requestCompleteAtServer(String, Execution, long)
- T4: PerformanceMeter.requestReceiveAtClient(String, Execution, long)
- T5: PerformanceMeter.requestCompleteAtClient(String, Execution, long)
Thus,
- Server Execution Time: T3 - T2
- Client Execution Time: T5 - T4
- Network Latency Time: (T4 - T3) + (T2 - T1)
Notice that, when we make a connection to load a page for the first time, only Server Execution Time is available. T4 and T5 will be saved on the client-side and sent back along with the next request.
Register as a Listener
Once implemented, you need to register it as a listener in WEB-INF/zk.xml
(assume the class is called foo.MyMeter):
<listener>
<listener-class>foo.MyMeter</listener-class>
</listener>