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 java.io.IOException;
11 import java.io.RandomAccessFile;
12 import java.util.Vector;
13 import java.util.logging.Level;
14 import java.util.logging.Logger;
20 public class PureIO extends CustomBenchmark{
23 protected void init() {
28 protected void execute() {
30 TransactionalFile f1 = (TransactionalFile)benchmark.m.get("0");
31 // RandomAccessFile f1 = ((TransactionalFile) benchmark.m.get("0")).file;
32 byte[] data = new byte[1];
33 char[] holder = new char[10000];
34 char[] word = new char[20];
36 long toseek = Integer.valueOf(Thread.currentThread().getName().substring(7)) * 20448;
38 // benchmark.filelock.lock();
43 //////////////// skipt the first word since its been read already
44 while (data[0] != '\n') {
53 while (f1.getFilePointer() < toseek + 20448) {
60 while (data[0] != '\n') {
67 holder[i] = (char) data[0];
72 byte[] towrite = new byte[String.valueOf(holder, 0, i).length()];
73 towrite = String.valueOf(holder, 0, i).getBytes();
77 // System.out.println(String.valueOf(holder,0,i).toLowerCase().substring(0, 1));
78 //((TransactionalFile) (benchmark.m.get(String.valueOf(holder,0,i).toLowerCase().substring(0, 1)))).file.write(towrite);
79 ((TransactionalFile) (benchmark.m.get(String.valueOf(holder,0,i).toLowerCase().substring(0, 1)))).write(towrite);
80 //update the memory //}
82 // benchmark.filelock.unlock();
83 } catch (IOException ex) {
84 Logger.getLogger(PureIO.class.getName()).log(Level.SEVERE, null, ex);
85 } catch (NullPointerException e) {
91 protected void printResults() {
92 throw new UnsupportedOperationException("Not supported yet.");
96 protected void execute(Vector arguments) {
97 throw new UnsupportedOperationException("Not supported yet.");