Package org.apache.sysds.utils.stats

# Class Timing

java.lang.Object
org.apache.sysds.utils.stats.Timing

public class Timing extends Object
Helper class to time the execution of elements

## Constructor Summary

Constructors
Constructor
Description
`Timing()`
Get a timer that is started.
`Timing(boolean start)`
Get a timing that is optionally started

## Method Summary

Modifier and Type
Method
Description
`void`
`start()`
Starts the time measurement.
`double`
`stop()`
Measures and returns the time since the last start() or stop() invocation and restarts the measurement.
`void`
`stopAndPrint()`
Measures and returns the time since the last start() or stop() invocation, restarts the measurement, and prints the last measurement to STDOUT.
`String`
`toString()`

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

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

## Constructor Details

### Timing

public Timing()
Get a timer that is started.

### Timing

public Timing(boolean start)
Get a timing that is optionally started

Parameters:
  `start` - If the timer should reset its time.

## Method Details

### start

public void start()
Starts the time measurement.

### stop

public double stop()
Measures and returns the time since the last start() or stop() invocation and restarts the measurement.

Returns:
  duration between start and stop

### stopAndPrint

public void stopAndPrint()
Measures and returns the time since the last start() or stop() invocation, restarts the measurement, and prints the last measurement to STDOUT.

### toString

public String toString()

Overrides:
  `toString` in class `Object`