home *** CD-ROM | disk | FTP | other *** search
- public class Timer {
- static long startTime = 0L;
- static long stopTime = 0L;
- static long sampTimeTot = 0L;
- static int sampTimeCount = 0;
- static long timeTot = 0L;
- static int count = 0;
-
- public static void report() {
- System.out.println("Sample");
- System.out.println("\t# of calls: " + sampTimeCount);
- System.out.println("\ttotal time: " + sampTimeTot);
- System.out.println("\tper pass: " + (double)sampTimeTot / (double)sampTimeCount);
- }
-
- public static void sampleEnd() {
- sampTimeTot = timeTot;
- sampTimeCount = count;
- timeTot = 0L;
- count = 0;
-
- for(int var0 = 0; var0 < sampTimeCount; ++var0) {
- start();
- stop();
- }
-
- sampTimeTot -= timeTot;
- timeTot = 0L;
- count = 0;
- }
-
- public static void sampleStart() {
- timeTot = 0L;
- count = 0;
- }
-
- public static void start() {
- startTime = System.currentTimeMillis();
- }
-
- public static void stop() {
- stopTime = System.currentTimeMillis();
- timeTot += stopTime - startTime;
- ++count;
- }
- }
-