01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.terracotta.session.util;
05:
06: public class Timer {
07: private long start = 0;
08: private long end = 0;
09:
10: public Timer() {
11: start();
12: }
13:
14: public Timer(boolean doStart) {
15: start = (doStart) ? System.currentTimeMillis() : 0;
16: }
17:
18: public void start() {
19: start = System.currentTimeMillis();
20: }
21:
22: public void stop() {
23: end = System.currentTimeMillis();
24: }
25:
26: public long elapsed() {
27: return end - start;
28: }
29:
30: public void reset() {
31: start = end = 0;
32: }
33:
34: public long getEnd() {
35: return end;
36: }
37:
38: public long getStart() {
39: return start;
40: }
41: }
|