01: package org.incava.util;
02:
03: /**
04: * Times an event, from when the object is created, until when the
05: * <code>end</code> method is invoked.
06: */
07: public class TimedEvent {
08: public long duration;
09:
10: private long startTime;
11:
12: private TimedEventSet set;
13:
14: public TimedEvent(TimedEventSet set) {
15: this .set = set;
16: this .startTime = System.currentTimeMillis();
17: }
18:
19: public void end() {
20: tr.Ace.log("ending");
21: duration = System.currentTimeMillis() - startTime;
22: set.add(duration);
23: tr.Ace.log("ended");
24: }
25: }
|