Class BenchmarkMetric

java.lang.Object
com.github.rlacher.sortbench.results.BenchmarkMetric

public final class BenchmarkMetric extends Object
Represents a raw profiling measurement from a single benchmark iteration.

The meaning of this metric value is determined by the Benchmarker.ProfilingMode used. This object is the direct result of a sorting operation, instantiated by the Benchmarker.

  • Constructor Details

    • BenchmarkMetric

      public BenchmarkMetric(Benchmarker.ProfilingMode mode, double value)
      Constructs a new BenchmarkMetric object.
      Parameters:
      mode - The profiling mode used during the benchmark iteration.
      value - The metric of the benchmark iteration.
      Throws:
      IllegalArgumentException - If either mode or value are negative.
  • Method Details

    • getProfilingMode

      public Benchmarker.ProfilingMode getProfilingMode()
      Returns the profiling mode used during the benchmark iteration.
      Returns:
      The profiling mode used in the benchmark.
    • getValue

      public double getValue()
      Returns a measurement value representing the profiling metric of a benchmark iteration.
      Returns:
      The benchmark metric value.
    • equals

      public boolean equals(Object obj)
      Checks if two BenchmarkMetric objects are equal based on their profiling mode and metric value.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object with which to compare.
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • hashCode

      public int hashCode()
      Generates a hash code for the BenchmarkMetric object based on its profiling mode and value.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code value for this object.
    • toString

      public String toString()
      Turns the BenchmarkMetric into a string representation.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the benchmark metric.