Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.nlp.util
Class Timing

    java.lang.Object
      edu.stanford.nlp.util.Timing

    public class Timing

extends Object

A class for measuring how long things take. For backward compatibility, this class contains static methods, but the preferred usage is to instantiate a Timing object and use instance methods.

Author:
  Bill MacCartney

Constructor Summary
`Timing()` Constructs new Timing object and starts the timer.

Method Summary
`void` | `doing(String str)` Print the start of timing message to stderr and start the timer.
`void` | `done()` Finish the line from startDoing with the end of the timing done message and elapsed time in x.y seconds.
`void` | `done(String msg)` Give a line saying that something is " done".
`static void` | `endDoing()` Finish the line from startDoing with the end of the timing done message and elapsed time in x.y seconds.
`static void` | `endDoing(String msg)` Finish the line from startDoing with the end of the timing done message and elapsed time in x.y seconds.
`static long` | `endTime()` Return elapsed time on (static) timer (without stopping timer).
`static long` | `endTime(String str)` Print elapsed time on (static) timer to `System.err` (without stopping timer).
`static long` | `endTime(String str, PrintStream stream)` Print elapsed time on (static) timer (without stopping timer).
`long` | `report()` Return elapsed time (without stopping timer).
`long` | `report(String str)` Print elapsed time to `System.err` (without stopping timer).
`long` | `report(String str, PrintStream stream)` Print elapsed time (without stopping timer).
`long` | `report(String str, PrintWriter writer)` Print elapsed time (without stopping timer).
`long` | `restart()` Restart timer.
`long` | `restart(String str)` Print elapsed time to `System.err` and restart timer.
`long` | `restart(String str, PrintStream stream)` Print elapsed time and restart timer.
`long` | `restart(String str, PrintWriter writer)` Print elapsed time and restart timer.
`void` | `start()` Start timer.
`static void` | `startDoing(String str)` Print the start of timing message to stderr and start the timer.
`static void` | `startTime()` Start (static) timer.
`long` | `stop()` Stop timer.
`long` | `stop(String str)` Print elapsed time to `System.err` and stop timer.
`long` | `stop(String str, PrintStream stream)` Print elapsed time and stop timer.
`long` | `stop(String str, PrintWriter writer)` Print elapsed time and stop timer.
`static long` | `tick()` Restart (static) timer.
`static long` | `tick(String str)` Print elapsed time to `System.err` and restart (static) timer.
`static long` | `tick(String str, PrintStream stream)` Print elapsed time and restart (static) timer.
`String` | `toSecondsString()`
`static String` | `toSecondsString(long elapsed)`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Timing

    public Timing()

  Constructs new Timing object and starts the timer.

Method Detail

### start

    public void start()

  Start timer.

### report

    public long report()

  Return elapsed time (without stopping timer).

  Returns:
    Number of milliseconds elapsed

### report

    public long report(String str,
                       PrintStream stream)

  Print elapsed time (without stopping timer).

  Parameters:
    `str` - Additional prefix string to be printed
    `stream` - PrintStream on which to write output
  Returns:
    Number of milliseconds elapsed

### report

    public long report(String str)

  Print elapsed time to `System.err` (without stopping timer).

  Parameters:
    `str` - Additional prefix string to be printed
  Returns:
    Number of milliseconds elapsed

### report

    public long report(String str,
                       PrintWriter writer)

  Print elapsed time (without stopping timer).

  Parameters:
    `str` - Additional prefix string to be printed
    `writer` - PrintWriter on which to write output
  Returns:
    Number of milliseconds elapsed

### toSecondsString

    public String toSecondsString()

### toSecondsString

    public static String toSecondsString(long elapsed)

### restart

    public long restart()

  Restart timer.

  Returns:
    Number of milliseconds elapsed

### restart

    public long restart(String str,
                        PrintStream stream)

  Print elapsed time and restart timer.

  Parameters:
    `str` - Additional prefix string to be printed
    `stream` - PrintStream on which to write output
  Returns:
    Number of milliseconds elapsed

### restart

    public long restart(String str)

  Print elapsed time to `System.err` and restart timer.

  Parameters:
    `str` - Additional prefix string to be printed
  Returns:
    Number of milliseconds elapsed

### restart

    public long restart(String str,
                        PrintWriter writer)

  Print elapsed time and restart timer.

  Parameters:
    `str` - Additional prefix string to be printed
    `writer` - PrintWriter on which to write output
  Returns:
    Number of milliseconds elapsed

### stop

    public long stop()

  Stop timer.

  Returns:
    Number of milliseconds elapsed

### stop

    public long stop(String str,
                     PrintStream stream)

  Print elapsed time and stop timer.

  Parameters:
    `str` - Additional prefix string to be printed
    `stream` - PrintStream on which to write output
  Returns:
    Number of milliseconds elapsed

### stop

    public long stop(String str)

  Print elapsed time to `System.err` and stop timer.

  Parameters:
    `str` - Additional prefix string to be printed
  Returns:
    Number of milliseconds elapsed

### stop

    public long stop(String str,
                     PrintWriter writer)

  Print elapsed time and stop timer.

  Parameters:
    `str` - Additional prefix string to be printed
    `writer` - PrintWriter on which to write output
  Returns:
    Number of milliseconds elapsed

### startTime

    public static void startTime()

  Start (static) timer.

### endTime

    public static long endTime()

  Return elapsed time on (static) timer (without stopping timer).

  Returns:
    Number of milliseconds elapsed

### endTime

    public static long endTime(String str,
                               PrintStream stream)

  Print elapsed time on (static) timer (without stopping timer).

  Parameters:
    `str` - Additional prefix string to be printed
    `stream` - PrintStream on which to write output
  Returns:
    Number of milliseconds elapsed

### endTime

    public static long endTime(String str)

  Print elapsed time on (static) timer to `System.err` (without stopping timer).

  Parameters:
    `str` - Additional prefix string to be printed
  Returns:
    Number of milliseconds elapsed

### doing

    public void doing(String str)

  Print the start of timing message to stderr and start the timer.

### done

    public void done()

  Finish the line from startDoing with the end of the timing done message and elapsed time in x.y seconds.

### done

    public void done(String msg)

  Give a line saying that something is " done".

### startDoing

    public static void startDoing(String str)

  Print the start of timing message to stderr and start the timer.

### endDoing

    public static void endDoing()

  Finish the line from startDoing with the end of the timing done message and elapsed time in x.y seconds.

### endDoing

    public static void endDoing(String msg)

  Finish the line from startDoing with the end of the timing done message and elapsed time in x.y seconds.

### tick

    public static long tick()

  Restart (static) timer.

  Returns:
    Number of milliseconds elapsed

### tick

    public static long tick(String str,
                            PrintStream stream)

  Print elapsed time and restart (static) timer.

  Parameters:
    `str` - Additional prefix string to be printed
    `stream` - PrintStream on which to write output
  Returns:
    Number of milliseconds elapsed

### tick

    public static long tick(String str)

  Print elapsed time to `System.err` and restart (static) timer.

  Parameters:
    `str` - Additional prefix string to be printed
  Returns:
    Number of milliseconds elapsed

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Stanford NLP Group