diff src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/xml/TransactionPerSecondMeasurement.java @ 19:17cc11b04157

change read function for transactionPerSecond
author one
date Sun, 15 Feb 2015 02:06:57 +0900
parents 190890be73e4
children 195c1a644550
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/xml/TransactionPerSecondMeasurement.java	Fri Dec 26 12:04:00 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/tatsuki/xml/TransactionPerSecondMeasurement.java	Sun Feb 15 02:06:57 2015 +0900
@@ -8,6 +8,11 @@
 import java.nio.ByteBuffer;
 import java.util.Random;
 
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.xml.sax.SAXException;
+
+import jp.ac.u_ryukyu.cr.ie.tatsuki.xmlTestBbs.JuGrix;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.DefaultJungle;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree;
@@ -19,35 +24,38 @@
 
 public class TransactionPerSecondMeasurement {
 
-  public static void main(String[] args) throws InterruptedException, IOException {
-    Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser()));
-    JungleTree tree = jungle.createNewTree("testTree");
-    JungleTreeEditor editor = tree.getTreeEditor();
-    editor = createTree(0, new DefaultNodePath(), editor);
-    System.out.println("endCreateTree");
-    editor = editor.success().b();
-    System.out.println(Runtime.getRuntime().availableProcessors());
+  public static void main(String[] args) throws InterruptedException, IOException, ParserConfigurationException, SAXException {
+//   Jungle jungle = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser()));
+//    JungleTree tree = jungle.createNewTree("testTree");
+//    JungleTreeEditor editor = tree.getTreeEditor();
+//    editor = createTree(0, new DefaultNodePath(), editor);
+    JuGrix jugrix = extendXmlTree.createJuGrix(true,100);
+    System.out.println("endCreatejugrixa ");
+//    editor = editor.success().b();
+     System.out.println(Runtime.getRuntime().availableProcessors());
 
     if (args.length > 0) {
+      
       if (args[0].equals("read"))
-        readOnly(tree);
+        readOnly(jugrix);
       if (args[0].equals("write"))
-        readAndWrite(tree);
+        readAndWrite(jugrix);
+
     } else
       System.out.println("Please with the argument");
   }
 
-  private static void readAndWrite(JungleTree tree) throws InterruptedException, IOException {
+  private static void readAndWrite(JuGrix jugrix) throws InterruptedException, IOException {
     System.out.println("read and write");
     File file = new File("./time/readAndWrite");
     PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
     for (int THREAD_COUNT = 1; THREAD_COUNT <= 12; THREAD_COUNT++) {
       ReadJungleThread readThread[] = new ReadJungleThread[THREAD_COUNT];
       for (int count = 0; THREAD_COUNT > count; count++) {
-        readThread[count] = new ReadJungleThread(tree);
+        readThread[count] = new ReadJungleThread(jugrix);
       }
 
-      WriteJungleThread writeThread =  new WriteJungleThread(tree);
+      WriteJungleThread writeThread =  new WriteJungleThread(null);
       writeThread.start();
       for (int count = 0; THREAD_COUNT > count; count++) {
         readThread[count].start();
@@ -73,15 +81,15 @@
     pw.close();
   }
 
-  private static void readOnly(JungleTree tree) throws InterruptedException, IOException {
-    System.out.println("read only");
+  private static void readOnly(JuGrix jugrix) throws InterruptedException, IOException {
+    System.out.println("read onlya");
     File file = new File("./time/readOnly");
     PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
     for (int THREAD_COUNT = 1; THREAD_COUNT <= 12; THREAD_COUNT++) {
       ReadJungleThread readThread[] = new ReadJungleThread[THREAD_COUNT];
       ;
       for (int count = 0; THREAD_COUNT > count; count++) {
-        readThread[count] = new ReadJungleThread(tree);
+        readThread[count] = new ReadJungleThread(jugrix);
       }
 
       for (int count = 0; THREAD_COUNT > count; count++) {