2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
6 package dstm2.benchmark;
8 import TransactionalIO.benchmarks.benchmark;
9 import TransactionalIO.core.TransactionalFile;
10 import dstm2.SpecialTransactionalFile;
11 import java.io.FileNotFoundException;
12 import java.io.IOException;
13 import java.io.RandomAccessFile;
14 import java.util.HashMap;
15 import java.util.Vector;
16 import java.util.logging.Level;
17 import java.util.logging.Logger;
23 public class PureIOdstm2version extends CustomBenchmark {
29 protected void init() {
32 for (int i = 0; i < 26; i++) {
34 benchmark.m.put(String.valueOf((char) (index + i) +"special"), new SpecialTransactionalFile("/scratch/TransactionalIO/PureIOBenchmarkFiles/" + String.valueOf((char) (index + i)) + ".text", "rw"));
35 //System.out.println(String.valueOf((char) (index + i) +"special"));
36 } catch (FileNotFoundException ex) {
37 Logger.getLogger(PureIOdstm2version.class.getName()).log(Level.SEVERE, null, ex);
44 protected void execute(Vector arguments) {
45 char[] holder = (char[]) arguments.get(0);
46 int i = ((Integer) (arguments.get(1))).intValue();
47 byte[] towrite = (byte[]) arguments.get(2);
50 // ((TransactionalFile) (benchmark.m.get(String.valueOf(holder,0,i).toLowerCase().substring(0, 1)))).write(towrite);
51 //System.out.println(((SpecialTransactionalFile) (benchmark.m.get(String.valueOf(holder,0,i).toLowerCase().substring(0, 1)+"special"))));
52 ((SpecialTransactionalFile) (benchmark.m.get(String.valueOf(holder,0,i).toLowerCase().substring(0, 1)+"special"))).write(towrite);
54 } catch (NullPointerException e){
55 System.out.println(String.valueOf(holder,0,i).toLowerCase().substring(0, 1)+"special");
58 } catch (IOException ex) {
59 Logger.getLogger(PureIO.class.getName()).log(Level.SEVERE, null, ex);
65 protected void printResults() {