4 //import java.util.Hashtable;
6 /**************************************************************************
8 * Java Grande Forum Benchmark Suite - Version 2.0 *
12 * Java Grande Benchmarking Project *
16 * Edinburgh Parallel Computing Centre *
18 * email: epcc-javagrande@epcc.ed.ac.uk *
21 * This version copyright (c) The University of Edinburgh, 1999. *
22 * All rights reserved. *
24 **************************************************************************/
26 public class JGFInstrumentor{
28 private Hashtable timers;
29 private Hashtable data;
30 // private static Hashtable timers;
31 // private static Hashtable data;
34 // timers = new Hashtable();
35 // data = new Hashtable();
38 public JGFInstrumentor(){
39 timers=new Hashtable();
43 public synchronized void addTimer (String name){
45 if (timers.containsKey(name)) {
46 System.out.println("JGFInstrumentor.addTimer: warning - timer " + name +
50 JGFTimer t=new JGFTimer(name);
52 // timers.put(name, new JGFTimer(name));
56 public synchronized void addTimer (String name, String opname){
58 if (timers.containsKey(name)) {
59 System.out.println("JGFInstrumentor.addTimer: warning - timer " + name +
63 JGFTimer t=new JGFTimer(name,opname);
65 // timers.put(name, new JGFTimer(name,opname));
70 public synchronized void addTimer (String name, String opname, int size){
72 if (timers.containsKey(name)) {
73 System.out.println("JGFInstrumentor.addTimer: warning - timer " + name +
77 JGFTimer t=new JGFTimer(name,opname,size);
79 // timers.put(name, new JGFTimer(name,opname,size));
84 public synchronized void startTimer(String name){
85 if (timers.containsKey(name)) {
86 ((JGFTimer) timers.get(name)).start();
89 System.out.println("JGFInstrumentor.startTimer: failed - timer " + name +
95 public synchronized void stopTimer(String name){
96 if (timers.containsKey(name)) {
97 ((JGFTimer) timers.get(name)).stop();
100 System.out.println("JGFInstrumentor.stopTimer: failed - timer " + name +
105 public synchronized void addOpsToTimer(String name, double count){
106 if (timers.containsKey(name)) {
107 ((JGFTimer) timers.get(name)).addops(count);
110 System.out.println("JGFInstrumentor.addOpsToTimer: failed - timer " + name +
115 public synchronized double readTimer(String name){
117 if (timers.containsKey(name)) {
118 time = ((JGFTimer) timers.get(name)).time;
121 System.out.println("JGFInstrumentor.readTimer: failed - timer " + name +
128 public synchronized void resetTimer(String name){
129 if (timers.containsKey(name)) {
130 ((JGFTimer) timers.get(name)).reset();
133 System.out.println("JGFInstrumentor.resetTimer: failed - timer " + name +
138 public synchronized void printTimer(String name){
139 if (timers.containsKey(name)) {
140 JGFTimer t=(JGFTimer) timers.get(name);
142 // ((JGFTimer) timers.get(name)).print();
145 System.out.println("JGFInstrumentor.printTimer: failed - timer " + name +
150 public synchronized void printperfTimer(String name){
151 if (timers.containsKey(name)) {
152 ((JGFTimer) timers.get(name)).printperf();
155 System.out.println("JGFInstrumentor.printTimer: failed - timer " + name +
160 // public static synchronized void storeData(String name, Object obj){
161 // data.put(name,obj);
164 public synchronized void retrieveData(String name, Object obj){
165 obj = data.get(name);
168 public synchronized void printHeader(int section, int size) {
173 base = "Java Grande Forum Benchmark Suite - Version 2.0 - Section ";
177 }else if(section==2){
179 header = base + "2 - Size A";
181 header = base + "2 - Size B";
183 header = base + "2 - Size C";
185 }else if(section==3){
187 header = base + "3 - Size A";
189 header = base + "3 - Size B";
193 System.out.println(header);
194 System.out.println("");