Class Measurement<T>

java.lang.Object
io.narayana.perf.Measurement<T>
All Implemented Interfaces:
Serializable

public class Measurement<T> extends Object implements Serializable
Author:
M Musgrove Config and result data for running a work load (@link{Measurement#measure})
See Also:
  • Constructor Details

    • Measurement

      public Measurement(int numberOfThreads, int numberOfCalls)
    • Measurement

      public Measurement(int numberOfThreads, int numberOfCalls, int batchSize)
    • Measurement

      public Measurement(long maxTestTime, int numberOfThreads, int numberOfCalls, int batchSize)
    • Measurement

      public Measurement(Measurement result)
  • Method Details

    • isRegression

      public boolean isRegression()
    • isFailOnRegression

      public boolean isFailOnRegression()
    • shouldFail

      public boolean shouldFail()
    • setRegression

      public void setRegression(boolean regression)
    • setContext

      public void setContext(T value)
    • getContext

      public T getContext()
    • getContexts

      public Set<T> getContexts()
    • getNumberOfMeasurements

      public int getNumberOfMeasurements()
    • getNumberOfThreads

      public int getNumberOfThreads()
    • getNumberOfCalls

      public int getNumberOfCalls()
    • getBatchSize

      public int getBatchSize()
    • getTotalMillis

      public long getTotalMillis()
    • getOne

      public long getOne()
    • setTotalMillis

      public void setTotalMillis(long totalMillis)
    • getThroughput

      public double getThroughput()
    • getNumberOfErrors

      public int getNumberOfErrors()
    • setNumberOfErrors

      public void setNumberOfErrors(int numberOfErrors)
    • incrementErrorCount

      public void incrementErrorCount()
    • incrementErrorCount

      public void incrementErrorCount(int delta)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setInfo

      public void setInfo(String info)
    • getInfo

      public String getInfo()
    • cancel

      public void cancel(boolean mayInterruptIfRunning)
      Cancel the measurement. A worker may cancel a measurement by invoking this method on the Measurement object it was passed in its @see Worker#doWork(T, int, Measurement) method
      Parameters:
      mayInterruptIfRunning - if false then any running calls to @see Worker#doWork will be allowed to finish before the the measurement is cancelled.
    • cancel

      public void cancel(String reason, boolean mayInterruptIfRunning)
      Cancel the measurement. A worker may cancel a measurement by invoking this method on the Measurement object it was passed in its @see Worker#doWork(T, int, Measurement) method
      Parameters:
      reason - the reason for the cancelation
      mayInterruptIfRunning - if false then any running calls to @see Worker#doWork will be allowed to finish before the the measurement is cancelled.
    • isCancelled

      public boolean isCancelled()
    • isMayInterruptIfRunning

      public boolean isMayInterruptIfRunning()
    • getMaxTestTime

      public long getMaxTestTime()
      Returns:
      max test time in milliseconds
    • getNumberOfWarmupCalls

      public int getNumberOfWarmupCalls()
    • isTimedOut

      public boolean isTimedOut()
      Returns:
      true if the measurement took longer than the maximum test time getMaxTestTime()
    • measure

      public Measurement<T> measure(WorkerWorkload<T> workload)
    • measure

      public Measurement<T> measure(WorkerLifecycle<T> lifecycle, WorkerWorkload<T> workload)
    • setException

      public void setException(Exception exception)
    • getException

      public Exception getException()