1 /**************************************************************************
3 * Java Grande Forum Benchmark Suite - Thread Version 1.0 *
7 * Java Grande Benchmarking Project *
11 * Edinburgh Parallel Computing Centre *
13 * email: epcc-javagrande@epcc.ed.ac.uk *
16 * This version copyright (c) The University of Edinburgh, 1999. *
17 * All rights reserved. *
19 **************************************************************************/
21 public class JGFTimer {
26 public double opcount;
30 private long start_time;
33 public JGFTimer(String name, String opname){
40 public JGFTimer(String name, String opname, int size){
47 public JGFTimer(String name){
54 if (on) System.out.println("Warning timer " + name + " was already turned on");
56 start_time = System.currentTimeMillis();
61 time += (double) (System.currentTimeMillis()-start_time) / 1000.;
62 if (!on) System.out.println("Warning timer " + name + " wasn't turned on");
67 public void addops(double count){
71 public void addtime(double added_time){
83 return opcount / time;
86 public void longprint(){
87 System.out.println("Timer Calls Time(s) Performance("+opname+"/s)");
88 System.out.println(name + " " + calls + " " + time + " " + this.perf());
92 if (opname.equals("")) {
93 System.out.println(name + " " + time + " (s)");
99 System.out.println(name + ":SizeA" + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
100 + " ("+opname+"/s)");
103 System.out.println(name + ":SizeB" + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
104 + " ("+opname+"/s)");
107 System.out.println(name + ":SizeC" + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
108 + " ("+opname+"/s)");
111 System.out.println(name + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
112 + " ("+opname+"/s)");
120 public void printperf(){
125 // pad name to 40 characters
126 while ( name.length() < 40 ) name = name + " ";
128 System.out.println(name + "\t" + (float)this.perf() + "\t"
129 + " ("+opname+"/s)");