net.sf.sparql.benchmarking.stats.impl
Class AbstractOperationRun

java.lang.Object
  extended by net.sf.sparql.benchmarking.stats.impl.AbstractOperationRun
All Implemented Interfaces:
Comparable<OperationRun>, OperationRun
Direct Known Subclasses:
OperationRunImpl, QueryRun, UpdateRun

public abstract class AbstractOperationRun
extends Object
implements OperationRun

Abstract implementation of an operation run

Author:
rvesse

Field Summary
 
Fields inherited from interface net.sf.sparql.benchmarking.stats.OperationRun
NOT_YET_RUN, UNKNOWN
 
Constructor Summary
protected AbstractOperationRun(long runtime, long resultCount)
          Creates an operation run which represents the results of running an operation
protected AbstractOperationRun(long runtime, long responseTime, long resultCount)
          Creates an operation run which represents the results of running an operation
protected AbstractOperationRun(String error, int errorCategory, long runtime)
          Creates a operation run which represents that the running of an operation resulted in an error
 
Method Summary
 int compareTo(OperationRun other)
          Compares a run to another
 int getErrorCategory()
          Gets an integer identifying the category of error
 String getErrorMessage()
          Gets the error message associated with the operation run, will be null if the operation ran successfully
 int getId()
          Gets the ID for the operation (if known)
 long getResponseTime()
          Gets the response time in nanoseconds
 long getResultCount()
          Gets the number of results returned for operations to which this is applicable
 long getRunOrder()
          Gets the global run order for this operation run
 long getRuntime()
          Gets the runtime in nanoseconds
 void setId(int id)
          Sets the ID for the operation
 void setRunOrder(long order)
          Sets the global run order for this operation run
 boolean wasSuccessful()
          Returns whether this run represents a successful (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOperationRun

protected AbstractOperationRun(String error,
                               int errorCategory,
                               long runtime)
Creates a operation run which represents that the running of an operation resulted in an error

Parameters:
error - Error Message
runtime - Runtime, this is the amount of time elapsed until the error/timeout was reached

AbstractOperationRun

protected AbstractOperationRun(long runtime,
                               long resultCount)
Creates an operation run which represents the results of running an operation

Parameters:
runtime - Runtime
resultCount - Result Count

AbstractOperationRun

protected AbstractOperationRun(long runtime,
                               long responseTime,
                               long resultCount)
Creates an operation run which represents the results of running an operation

Parameters:
runtime - Runtime
responseTime - Response Time
resultCount - Result Count
Method Detail

getRuntime

public long getRuntime()
Description copied from interface: OperationRun
Gets the runtime in nanoseconds

Specified by:
getRuntime in interface OperationRun
Returns:
Runtime in nanoseconds

getResponseTime

public long getResponseTime()
Description copied from interface: OperationRun
Gets the response time in nanoseconds

Response Time is an additional metric which currently is only calculated for certain operations. This metric is the time taken for the first results of the operation to become available so where the operation receives a streamed response this may be much smaller than the OperationRun.getRuntime() statistic.

Specified by:
getResponseTime in interface OperationRun
Returns:
Response Time in nanoseconds

getResultCount

public long getResultCount()
Description copied from interface: OperationRun
Gets the number of results returned for operations to which this is applicable

Specified by:
getResultCount in interface OperationRun
Returns:
Number of results

wasSuccessful

public boolean wasSuccessful()
Description copied from interface: OperationRun
Returns whether this run represents a successful (i.e. non-error) run of the operation

Specified by:
wasSuccessful in interface OperationRun
Returns:
True if the run was successful

getErrorMessage

public String getErrorMessage()
Description copied from interface: OperationRun
Gets the error message associated with the operation run, will be null if the operation ran successfully

Specified by:
getErrorMessage in interface OperationRun
Returns:
Error Message or null

getErrorCategory

public int getErrorCategory()
Description copied from interface: OperationRun
Gets an integer identifying the category of error

Some basic categories are provided by ErrorCategories and the return type of this method is explicitly an int rather than some category enum in order to allow users of the API to define their own error categories for their custom operations.

Specified by:
getErrorCategory in interface OperationRun
Returns:
Error category

getRunOrder

public long getRunOrder()
Description copied from interface: OperationRun
Gets the global run order for this operation run

This is the order the operation was run in relative to all other operations run in the benchmark and is primarily useful when looking at the results of multi-threaded benchmarks.

Specified by:
getRunOrder in interface OperationRun
Returns:
Global Order

setRunOrder

public void setRunOrder(long order)
                 throws IllegalAccessError
Description copied from interface: OperationRun
Sets the global run order for this operation run

Intended for use by OperationRunner implementations to allow them to record the run order of this operation relative to all other operations run, this is primarily useful when tracking multi-threaded runs. Trying to set this once it has been set will lead to an IllegalAccessError

Specified by:
setRunOrder in interface OperationRun
Parameters:
order - Order
Throws:
IllegalAccessError - Thrown if you try to set the run order after it has been set

getId

public int getId()
Description copied from interface: OperationRun
Gets the ID for the operation (if known)

This ID can be used to link the operation run back to an operation in the originating operation mix, this can be useful when using OperationMixRunner implementations which may run the same operation multiple times in a single mix run or may not necessarily run all operations every time.

Specified by:
getId in interface OperationRun
Returns:
ID if known, OperationRun.UNKNOWN otherwise

setId

public void setId(int id)
           throws IllegalAccessError
Description copied from interface: OperationRun
Sets the ID for the operation

Specified by:
setId in interface OperationRun
Throws:
IllegalAccessError

compareTo

public int compareTo(OperationRun other)
Compares a run to another

Used for sorting the runs so outliers can be trimmed

Specified by:
compareTo in interface Comparable<OperationRun>


Copyright © 2014. All Rights Reserved.