Package com.ibm.icu.dev.test.perf
Class PerfTest.Function
java.lang.Object
com.ibm.icu.dev.test.perf.PerfTest.Function
- Direct Known Subclasses:
ResourceBundlePerf.GetBinaryIcu
,ResourceBundlePerf.GetBinaryJava
,ResourceBundlePerf.GetIntIcu
,ResourceBundlePerf.GetIntJava
,ResourceBundlePerf.GetIvIcu
,ResourceBundlePerf.GetIvJava
,ResourceBundlePerf.GetMenuIcu
,ResourceBundlePerf.GetMenuJava
,ResourceBundlePerf.GetStringIcu
,ResourceBundlePerf.GetStringJava
- Enclosing class:
PerfTest
Subclasses of PerfTest will need to create subclasses of Function that
define a call() method which contains the code to be timed. They then
call setTestFunction() in their "Test..." method to establish this as the
current test functor.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
call()
Subclasses should implement this method to do the action to be measured if the action is thread-safevoid
call
(int i) Subclasses should implement this method if the action is not thread-safelong
Subclasses may implement this method to return either positive or negative integer indicating the number of events in a single call to this object's call() method.final int
getID()
long
Subclasses may implement this method to return positive integer indicating the number of operations in a single call to this object's call() method.void
init()
init is called each time before looping through callfinal void
setID
(int id) final long
time
(long n) Call call() n times in a tight loop and return the elapsed milliseconds.
-
Field Details
-
id
private int id
-
-
Constructor Details
-
Function
public Function()
-
-
Method Details
-
call
public void call()Subclasses should implement this method to do the action to be measured if the action is thread-safe -
call
public void call(int i) Subclasses should implement this method if the action is not thread-safe -
getOperationsPerIteration
public long getOperationsPerIteration()Subclasses may implement this method to return positive integer indicating the number of operations in a single call to this object's call() method. If subclasses do not override this method, the default implementation returns 1. -
getEventsPerIteration
public long getEventsPerIteration()Subclasses may implement this method to return either positive or negative integer indicating the number of events in a single call to this object's call() method. If subclasses do not override this method, the default implementation returns -1, indicating that events are not applicable to this test. e.g: Number of breaks / iterations for break iterator -
time
public final long time(long n) Call call() n times in a tight loop and return the elapsed milliseconds. If n is small and call() is fast the return result may be zero. Small return values have limited meaningfulness, depending on the underlying VM and OS. -
init
public void init()init is called each time before looping through call -
getID
public final int getID() -
setID
public final void setID(int id)
-