*** empty log message ***
[IRC.git] / Robust / Transactions / dstm2 / src / dstm2 / benchmark / PureIOdstm2version.java
1 /*
2  * To change this template, choose Tools | Templates
3  * and open the template in the editor.
4  */
5
6 package dstm2.benchmark;
7
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;
18
19 /**
20  *
21  * @author navid
22  */
23 public class PureIOdstm2version extends CustomBenchmark {
24
25     
26     
27     int count = 0;
28     @Override
29     protected void init() {
30          int index = 97;
31             
32             for (int i = 0; i < 26; i++) { 
33                 try {
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);
38                 }
39                     count++;
40             }   
41     }
42
43     
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);
48         try {
49             
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);         
53    //           
54         } catch (NullPointerException e){
55              System.out.println(String.valueOf(holder,0,i).toLowerCase().substring(0, 1)+"special");
56              
57         
58         } catch (IOException ex) {
59             Logger.getLogger(PureIO.class.getName()).log(Level.SEVERE, null, ex);
60         }
61         
62     }
63
64     
65     protected void printResults() {
66         
67     }
68
69 }