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
public abstract static class PerfTest.Function extends java.lang.Object
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 Modifier and Type Field Description private int
id
-
Constructor Summary
Constructors Constructor Description Function()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
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.int
getID()
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.void
init()
init is called each time before looping through callvoid
setID(int id)
long
time(long n)
Call call() n times in a tight loop and return the elapsed milliseconds.
-
-
-
Method Detail
-
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)
-
-