Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.2.4 generated on January 7 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.manage
Class TimeWatch

    java.lang.Object
      |
      +--com.solarmetric.manage.TimeWatch

All Implemented Interfaces:
  Watchable

public class TimeWatch
extends Object
implements Watchable

A TimeWatch allows for marking code blocks and recording execution time statistics.

An example use would be:

`TimeWatch tw = new TimeWatch (manager, "MyTimeWatch");`

`TimeWatch.Token token = tw.createToken ("namedBlock");`

`// do stuff to be timed.`

`token.stop ();`

A more common use in Kodo would be:

`KodoPersistenceManager kpm = ...;`

`TimeWatch tw = KodoTimeWatchManager.getTimeWatch (kpm);`

`TimeWatch.Token token = tw.createToken ("namedBlock");`

`// do stuff to be timed.`

`token.stop ();`

Another typical use would be for timing iterations:

`KodoPersistenceManager kpm = ...;`

`TimeWatch tw = KodoTimeWatchManager.getTimeWatch (kpm);`

`TimeWatch.Token token = tw.createToken ("namedBlock");`

`while (...)`

`{`

`// do stuff to be timed.`

`token.stop ();`

`}`

Another typical use when timing iterations:

`KodoPersistenceManager kpm = ...;`

`TimeWatch tw = KodoTimeWatchManager.getTimeWatch (kpm);`

`TimeWatch.Token token = tw.createToken ("namedBlock");`

`while (...)`

`{`

`// do stuff not to be timed.`

`token.restart ();`

`// do stuff to be timed.`

`token.stop ();`

`}`

Inner Class Summary
`static class` | `TimeWatch.Token` A timer token.

Constructor Summary
`TimeWatch()` Create a new TimeWatch Watchable with the passed name.

Method Summary
`boolean` | `addListener(WatchableListener listener)` Add a listener.
`void` | `clearListeners()` Clear all listeners.
`TimeWatch.Token` | `createToken(String name)` Create a timer token.
`Collection` | `getStatistics()` Get a collection of available statistics.
`boolean` | `removeListener(WatchableListener listener)` Remove a listener.

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

Constructor Detail

### TimeWatch

    public TimeWatch()

  Create a new TimeWatch Watchable with the passed name.

Method Detail

### createToken

    public TimeWatch.Token createToken(String name)

  Create a timer token.

### addListener

    public boolean addListener(WatchableListener listener)

  Add a listener.
  Specified by:
    `addListener` in interface `Watchable`

### removeListener

    public boolean removeListener(WatchableListener listener)

  Remove a listener.
  Specified by:
    `removeListener` in interface `Watchable`

### clearListeners

    public void clearListeners()

  Clear all listeners.
  Specified by:
    `clearListeners` in interface `Watchable`

### getStatistics

    public Collection getStatistics()

  Get a collection of available statistics. Items are of type Statistic.
  Specified by:
    `getStatistics` in interface `Watchable`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.2.4 generated on January 7 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.