Benchmark
Date: 2016-02-29

de.zib.scalaris

## Class Benchmark

- java.lang.Object
- - de.zib.scalaris.Benchmark

- Direct Known Subclasses:
    FastStringBenchmark

      public class Benchmark
      extends Object

  Provides methods to run benchmarks and print the results. Also provides some default benchmarks.
  Since:
    2.0
  Version:
    3.6
  Author:
    Nico Kruber, kruber@zib.de

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Benchmark()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> T` | `getRandom(int size, Class<T> c)` Creates an object T from `size` random bytes.
    `static <T> T` | `getRandom(int size, Class<T> c, Random r)` Creates an object T from `size` random bytes.
    `static void` | `minibench(int operations, int threadsPerNode, Set<Integer> benchmarks)` Default minimal benchmark.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Benchmark

          public Benchmark()

  - ### Method Detail

    - #### minibench

          public static void minibench(int operations,
                       int threadsPerNode,
                       Set<Integer> benchmarks)

      Default minimal benchmark. Tests some strategies for writing key/value pairs to scalaris:
      1. writing `OtpErlangBinary` objects (random data, size = `BENCH_DATA_SIZE`)
      2. writing `String` objects (random data, size = `BENCH_DATA_SIZE`)
      each with the given number of consecutive operations and parallel threads per Scalaris node,
      - first using a new `Transaction` or `TransactionSingleOp` for each test,
      - then using a new `Transaction` or `TransactionSingleOp` but re-using a single `Connection`,
      - and finally re-using a single `Transaction` or `TransactionSingleOp` object.
      Parameters:
        `operations` - the number of test runs to execute
        `threadsPerNode` - number of threads to spawn for each existing Scalaris node
        `benchmarks` - the benchmarks to run (1-18 or -1 for all benchmarks)

    - #### getRandom

          public static <T> T getRandom(int size,
                        Class<T> c)
                             throws IllegalArgumentException,
                                    SecurityException,
                                    InstantiationException,
                                    IllegalAccessException,
                                    InvocationTargetException,
                                    NoSuchMethodException

      Creates an object T from `size` random bytes. Uses either a constructor that expects a `byte[]` or a `String` parameter (in which case the UTF-8 encoding is used for the bytes).
      Type Parameters:
        `T` - the type of the object to create
      Parameters:
        `size` - the number of (random) bytes to create
        `c` - the class of the object to create (needed due to type erasure)
      Returns:
        the created object
      Throws:
        `IllegalAccessException` - - if this Constructor object enforces Java language access control and the underlying constructor is inaccessible.
        `IllegalArgumentException` - - if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion; if this constructor pertains to an enum type.
        `InstantiationException` - - if the class that declares the underlying constructor represents an abstract class.
        `InvocationTargetException` - - if the underlying constructor throws an exception.
        `ExceptionInInitializerError` - - if the initialization provoked by this method fails.
        `NoSuchMethodException` - - if a matching method is not found.
        `SecurityException` - - If a security manager, s, is present and any of the following conditions is met: invocation of s.checkMemberAccess(this, Member.PUBLIC) denies access to the constructor the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class

    - #### getRandom

          public static <T> T getRandom(int size,
                        Class<T> c,
                        Random r)
                             throws IllegalArgumentException,
                                    SecurityException,
                                    InstantiationException,
                                    IllegalAccessException,
                                    InvocationTargetException,
                                    NoSuchMethodException

      Creates an object T from `size` random bytes. Uses either a constructor that expects a `byte[]` or a `String` parameter (in which case the UTF-8 encoding is used for the bytes).
      Type Parameters:
        `T` - the type of the object to create
      Parameters:
        `size` - the number of (random) bytes to create
        `c` - the class of the object to create (needed due to type erasure)
        `r` - the random number generator to use
      Returns:
        the created object
      Throws:
        `IllegalAccessException` - - if this Constructor object enforces Java language access control and the underlying constructor is inaccessible.
        `IllegalArgumentException` - - if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion; if this constructor pertains to an enum type.
        `InstantiationException` - - if the class that declares the underlying constructor represents an abstract class.
        `InvocationTargetException` - - if the underlying constructor throws an exception.
        `ExceptionInInitializerError` - - if the initialization provoked by this method fails.
        `NoSuchMethodException` - - if a matching method is not found.
        `SecurityException` - - If a security manager, s, is present and any of the following conditions is met: invocation of s.checkMemberAccess(this, Member.PUBLIC) denies access to the constructor the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class