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 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
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Subclasses should implement this method to do the action to be measured if the action is thread-safe
    void
    call(int i)
    Subclasses should implement this method if the action is not thread-safe
    long
    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
     
    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 is called each time before looping through call
    final void
    setID(int id)
     
    final long
    time(long n)
    Call call() n times in a tight loop and return the elapsed milliseconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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)