BenchCollector.java 3.2 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
package jcircus.benchmarking;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.Vector;

public class BenchCollector {
private Vector <String> specpathsin = new Vector <String> ();
private Vector <String> specpathsout = new Vector <String> ();
private Vector <String> specnames = new Vector <String> ();
private HashMap <String, String> main2spec = new HashMap <String, String> ();
private int numOfSpecs = 0;
public int getNumberOfSpecs () {
return numOfSpecs;
}
public HashMap <String, String> getCreateMain () {
return main2spec;
}
public Vector <String> getSpecNames () {
return specnames;
}
public Vector <String> getPathsIn () {
return this.specpathsin;
}
public Vector <String> getPathsOut () {
return this.specpathsout;
}
public BenchCollector () {
storeInfoFromBenchsFile ();
}
private String [] tokenize (String str) {
StringTokenizer st = new StringTokenizer (str);
int ntokens = st.countTokens();
if (ntokens != 2) {
try {
throw new Exception ("Wrong number of words. Should try <specname> <generatemain>");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.exit (0);
}
}
String [] tokens = new String [ntokens];
int counter = 0;
while (st.hasMoreTokens()) {
tokens [counter] = st.nextToken();
counter++;
}
return tokens;
}

public void storeInfoFromBenchsFile () {
//String benchspath = "C:\\Users\\sam\\Softwares\\workspaceGalileo\\circus\\src\\jcircus\\benchmarking\\benchs.txt";
String benchspath = "/home/samuel/Softwares/CRefineProject/circus/src/jcircus/benchmarking/benchs.txt";
System.out.println (benchspath);
try {
BufferedReader br = new BufferedReader (new FileReader (benchspath));
int numberOfSpecs = Integer.parseInt(br.readLine());
this.numOfSpecs = numberOfSpecs;
int counter = 0;
while (counter < numberOfSpecs) {
String [] tokens = tokenize (br.readLine());
assert (tokens.length == 2);
specnames.addElement(tokens [0]);
main2spec.put(tokens [0], tokens [1]);
counter++;
}
for (int i = 0; i < specnames.size(); i++) {
//specpathsin.addElement ("C:\\Users\\sam\\Softwares\\workspaceGalileo\\circus\\src\\jcircus\\benchmarking\\benchinputs\\" + specnames.elementAt(i));
//specpathsout.addElement ("C:\\Users\\sam\\Softwares\\workspaceGalileo\\BenchOutputs\\" + specnames.elementAt(i));
specpathsin.addElement ("/home/samuel/Softwares/CRefineProject/circus/src/jcircus/benchmarking/benchinputs/" + specnames.elementAt(i));
specpathsout.addElement ("/home/samuel/Softwares/workspaceJuno/BenchOutputs/" + specnames.elementAt(i));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException io) {
io.printStackTrace();
}
}
public void printPaths () {
for (int i = 0; i < this.specnames.size(); i++) {
System.out.println (this.specpathsin.elementAt(i));
}
}
public static void main (String args []) {
BenchCollector b = new BenchCollector ();
b.printPaths();
}
}