vxquery-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject [2/2] git commit: Added a disk performance test to help identify the disk speed and parsing speed.
Date Thu, 10 Jul 2014 01:34:01 GMT
Added a disk performance test to help identify the disk speed and parsing speed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/1b7d3aaf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/1b7d3aaf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/1b7d3aaf

Branch: refs/heads/prestonc/benchmark_updates
Commit: 1b7d3aafe23fec163527684ad499e84064263e6f
Parents: 5f72282
Author: Preston Carman <prestonc@apache.org>
Authored: Wed Jul 9 18:29:41 2014 -0700
Committer: Preston Carman <prestonc@apache.org>
Committed: Wed Jul 9 18:29:41 2014 -0700

----------------------------------------------------------------------
 .../noaa-ghcn-daily/scripts/run_benchmark.sh    |  10 +-
 .../scripts/run_benchmark_cluster.sh            |   8 +-
 .../noaa-ghcn-daily/scripts/run_mrql_tests.sh   |   6 +-
 .../java/org/apache/vxquery/cli/VXQuery.java    |   5 +
 .../org/apache/vxquery/xmlparser/XMLParser.java |  18 +-
 vxquery-xtest/pom.xml                           |   4 +
 .../vxquery/xtest/util/DiskPerformance.java     | 214 +++++++++++++++++++
 .../xtest/util/tests/AbstractDiskTest.java      |  78 +++++++
 .../tests/BufferedParsedCharacterStream.java    |  45 ++++
 .../tests/BufferedReaderBufferedStream.java     |  45 ++++
 .../xtest/util/tests/BufferedReaderStream.java  |  43 ++++
 .../xtest/util/tests/BufferedStream.java        |  42 ++++
 .../vxquery/xtest/util/tests/IDiskTest.java     |  15 ++
 .../util/tests/ParsedBufferedByteStream.java    |  48 +++++
 .../tests/ParsedBufferedCharacterStream.java    |  48 +++++
 .../xtest/util/tests/ParsedByteStream.java      |  46 ++++
 .../xtest/util/tests/ParsedCharacterStream.java |  47 ++++
 .../xtest/util/tests/ReaderBufferedStream.java  |  43 ++++
 .../vxquery/xtest/util/tests/ReaderStream.java  |  42 ++++
 .../apache/vxquery/xtest/util/tests/Stream.java |  41 ++++
 20 files changed, 827 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh
index 9b79277..ff2d761 100755
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh
@@ -27,7 +27,7 @@
 #
 REPEAT=5
 FRAME_SIZE=10000
-BUFFER_SIZE=8192
+BUFFER_SIZE=$((8*1024*1024))
 
 if [ -z "${1}" ]
 then
@@ -35,18 +35,20 @@ then
     exit
 fi
 
-export JAVA_OPTS="$JAVA_OPTS -server -Xmx1G -XX:+HeapDumpOnOutOfMemoryError -Djava.util.logging.config.file=./vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/benchmark_logging.properties"
+export JAVA_OPTS="$JAVA_OPTS -server -Xmx8G -XX:+HeapDumpOnOutOfMemoryError -Djava.util.logging.config.file=./vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/benchmark_logging.properties"
 
 for j in $(find ${1} -name '*q??.xq')
 do
     if [ -z "${3}" ] || [[ "${j}" =~ "${3}" ]] 
     then
-    	date
+        date
         echo "Running query: ${j}"
         log_file="$(basename ${j}).$(date +%Y%m%d%H%M).log"
         log_base_path=$(dirname ${j/queries/query_logs})
         mkdir -p ${log_base_path}
-time sh ./vxquery-cli/target/appassembler/bin/vxq ${j} ${2} -timing -showquery -showoet -showrp -frame-size ${FRAME_SIZE} -buffer-size ${BUFFER_SIZE} -repeatexec ${REPEAT} > ${log_base_path}/${log_file} 2>&1
+        time sh ./vxquery-cli/target/appassembler/bin/vxq ${j} ${2} -timing -showquery -showoet -showrp -frame-size ${FRAME_SIZE} -buffer-size ${BUFFER_SIZE} -repeatexec ${REPEAT} > ${log_base_path}/${log_file} 2>&1
+        echo "Buffer Size: ${BUFFER_SIZE}" >> ${log_base_path}/${log_file}
+        echo "Frame Size: ${FRAME_SIZE}" >> ${log_base_path}/${log_file}
     fi;
 done
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark_cluster.sh
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark_cluster.sh b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark_cluster.sh
index a00de98..67b7ca7 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark_cluster.sh
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark_cluster.sh
@@ -27,7 +27,7 @@
 #
 REPEAT=5
 FRAME_SIZE=10000
-BUFFER_SIZE=8192
+BUFFER_SIZE=1*1024*1024
 
 if [ -z "${1}" ]
 then
@@ -48,7 +48,7 @@ python vxquery-server/src/main/resources/scripts/cluster_cli.py -c vxquery-serve
 # wait for cluster to finish setting up  
 sleep 5
 
-export JAVA_OPTS="$JAVA_OPTS -server -Xmx1G -XX:+HeapDumpOnOutOfMemoryError -Djava.util.logging.config.file=./vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/benchmark_logging.properties"
+export JAVA_OPTS="$JAVA_OPTS -server -Xmx8G -XX:+HeapDumpOnOutOfMemoryError -Djava.util.logging.config.file=./vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/benchmark_logging.properties"
 
 for j in $(find ${1} -name '*q??.xq')
 do
@@ -58,12 +58,14 @@ do
         # Only run for specified queries.
         if [ -z "${4}" ] || [[ "${j}" =~ "${4}" ]]
         then
-        	date
+            date
             echo "Running query: ${j}"
             log_file="$(basename ${j}).$(date +%Y%m%d%H%M).log"
             log_base_path=$(dirname ${j/queries/query_logs})
             mkdir -p ${log_base_path}
             time sh ./vxquery-cli/target/appassembler/bin/vxq ${j} ${3} -timing -showquery -showoet -showrp -frame-size ${FRAME_SIZE} -buffer-size ${BUFFER_SIZE} -repeatexec ${REPEAT} > ${log_base_path}/${log_file} 2>&1
+            echo "\nBuffer Size: ${BUFFER_SIZE}" >> ${log_base_path}/${log_file}
+            echo "\nFrame Size: ${FRAME_SIZE}" >> ${log_base_path}/${log_file}
         fi;
     fi;
 done

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_mrql_tests.sh
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_mrql_tests.sh b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_mrql_tests.sh
index eb1b2a2..1fa58dd 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_mrql_tests.sh
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_mrql_tests.sh
@@ -24,9 +24,9 @@ DATASET="hcn"
 for n in `seq 0 7`
 #for n in 0
 do
-	date
-	echo "Running q0${n} on ${DATASET} for MRQL."
-	time for i in {1..${REPEAT}}; do ~/mrql/incubator-mrql/bin/mrql -dist -nodes 5 ~/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/other_systems/mrql_${DATASET}/q0${n}.mrql >> weather_data/mrql/query_logs/${DATASET}/q0${n}.mrql.log 2>&1; done; 
+    date
+    echo "Running q0${n} on ${DATASET} for MRQL."
+    time for i in {1..${REPEAT}}; do ~/mrql/incubator-mrql/bin/mrql -dist -nodes 5 ~/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/other_systems/mrql_${DATASET}/q0${n}.mrql >> weather_data/mrql/query_logs/${DATASET}/q0${n}.mrql.log 2>&1; done; 
 done
 
 SUBJECT="MRQL Tests Finished (${DATASET})"

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
----------------------------------------------------------------------
diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
index 02697e9..61226e5 100644
--- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
+++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
@@ -148,6 +148,8 @@ public class VXQuery {
      * @throws Exception
      */
     private void execute() throws Exception {
+        System.setProperty("vxquery.buffer_size",Integer.toString(opts.bufferSize));
+        
         if (opts.clientNetIpAddress != null) {
             hcc = new HyracksConnection(opts.clientNetIpAddress, opts.clientNetPort);
             runQueries();
@@ -446,6 +448,9 @@ public class VXQuery {
         @Option(name = "-frame-size", usage = "Frame size in bytes. (default 65536)")
         public int frameSize = 65536;
 
+        @Option(name = "-buffer-size", usage = "Read file buffer size in bytes. (default 512)")
+        public int bufferSize = 512;
+
         @Option(name = "-O", usage = "Optimization Level. Default: Full Optimization")
         private int optimizationLevel = Integer.MAX_VALUE;
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
index 0c31d27..1aea1e6 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
@@ -14,6 +14,7 @@
  */
 package org.apache.vxquery.xmlparser;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -22,7 +23,6 @@ import java.io.InputStreamReader;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.zip.GZIPInputStream;
 
 import org.apache.vxquery.context.StaticContext;
 import org.apache.vxquery.exceptions.VXQueryFileNotFoundException;
@@ -44,6 +44,7 @@ public class XMLParser {
     final SAXContentHandler handler;
     final InputSource in;
     final String nodeId;
+    final int buffer_size;
 
     public XMLParser(boolean attachTypes, ITreeNodeIdProvider idProvider, String nodeId) throws HyracksDataException {
         this(attachTypes, idProvider, nodeId, null, null, null, null);
@@ -52,9 +53,12 @@ public class XMLParser {
     public XMLParser(boolean attachTypes, ITreeNodeIdProvider idProvider, String nodeId, ByteBuffer frame,
             FrameTupleAppender appender, List<Integer> childSeq, StaticContext staticContext)
             throws HyracksDataException {
+        buffer_size = Integer.parseInt(System.getProperty("vxquery.buffer_size"));
         this.nodeId = nodeId;
         try {
             parser = XMLReaderFactory.createXMLReader();
+            
+            System.out.println("XMLReader buffer:" +parser.getProperty("http://apache.org/xml/properties/input-buffer-size"));
             if (frame == null || appender == null) {
                 handler = new SAXContentHandler(attachTypes, idProvider);
             } else {
@@ -74,11 +78,7 @@ public class XMLParser {
 
     public void parseDocument(File file, ArrayBackedValueStorage abvs) throws HyracksDataException {
         try {
-            if (file.getName().toLowerCase().endsWith(".xml.gz")) {
-                in.setCharacterStream(new InputStreamReader(new GZIPInputStream(new FileInputStream(file))));
-            } else {
-                in.setCharacterStream(new InputStreamReader(new FileInputStream(file)));
-            }
+            in.setCharacterStream(new BufferedReader(new InputStreamReader(new FileInputStream(file)), buffer_size));
             parser.parse(in);
             handler.writeDocument(abvs);
         } catch (FileNotFoundException e) {
@@ -99,11 +99,7 @@ public class XMLParser {
     public void parseElements(File file, IFrameWriter writer, FrameTupleAccessor fta, int tupleIndex)
             throws HyracksDataException {
         try {
-            if (file.getName().toLowerCase().endsWith(".xml.gz")) {
-                in.setCharacterStream(new InputStreamReader(new GZIPInputStream(new FileInputStream(file))));
-            } else {
-                in.setCharacterStream(new InputStreamReader(new FileInputStream(file)));
-            }
+            in.setCharacterStream(new BufferedReader(new InputStreamReader(new FileInputStream(file)), buffer_size));
             handler.setupElementWriter(writer, fta, tupleIndex);
             parser.parse(in);
         } catch (FileNotFoundException e) {

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/pom.xml
----------------------------------------------------------------------
diff --git a/vxquery-xtest/pom.xml b/vxquery-xtest/pom.xml
index 35bfa27..ee79b2a 100644
--- a/vxquery-xtest/pom.xml
+++ b/vxquery-xtest/pom.xml
@@ -50,6 +50,10 @@
                   <mainClass>org.apache.vxquery.xtest.Main</mainClass>
                   <name>xtest</name>
                 </program>
+                <program>
+                  <mainClass>org.apache.vxquery.xtest.util.DiskPerformance</mainClass>
+                  <name>diskperformance</name>
+                </program>
               </programs>
               <repositoryLayout>flat</repositoryLayout>
               <repositoryName>lib</repositoryName>

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/DiskPerformance.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/DiskPerformance.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/DiskPerformance.java
new file mode 100644
index 0000000..913d22e
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/DiskPerformance.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.vxquery.datamodel.builders.atomic.StringValueBuilder;
+import org.apache.vxquery.metadata.VXQueryIOFileFilter;
+import org.apache.vxquery.types.AnyType;
+import org.apache.vxquery.types.ElementType;
+import org.apache.vxquery.types.NameTest;
+import org.apache.vxquery.types.Quantifier;
+import org.apache.vxquery.types.SequenceType;
+import org.apache.vxquery.xmlparser.SAXContentHandler;
+import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
+import org.apache.vxquery.xtest.util.tests.BufferedParsedCharacterStream;
+import org.apache.vxquery.xtest.util.tests.BufferedReaderBufferedStream;
+import org.apache.vxquery.xtest.util.tests.BufferedReaderStream;
+import org.apache.vxquery.xtest.util.tests.BufferedStream;
+import org.apache.vxquery.xtest.util.tests.IDiskTest;
+import org.apache.vxquery.xtest.util.tests.ParsedBufferedByteStream;
+import org.apache.vxquery.xtest.util.tests.ParsedBufferedCharacterStream;
+import org.apache.vxquery.xtest.util.tests.ParsedByteStream;
+import org.apache.vxquery.xtest.util.tests.ParsedCharacterStream;
+import org.apache.vxquery.xtest.util.tests.ReaderBufferedStream;
+import org.apache.vxquery.xtest.util.tests.ReaderStream;
+import org.apache.vxquery.xtest.util.tests.Stream;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+
+public class DiskPerformance {
+    XMLReader parser;
+    SAXContentHandler handler;
+    Collection<File> cTestFiles;
+    Iterator<File> testFilesIt;
+
+    public DiskPerformance() {
+        Pair<XMLReader, SAXContentHandler> p = getNewParser();
+        parser = p.first;
+        handler = p.second;
+        cTestFiles = null;
+    }
+
+    public Pair<XMLReader, SAXContentHandler> getNewParser() {
+        XMLReader parser;
+        SAXContentHandler handler;
+
+        try {
+            parser = XMLReaderFactory.createXMLReader();
+            List<SequenceType> childSeq = new ArrayList<SequenceType>();
+            NameTest nt = new NameTest(createUTF8String(""), createUTF8String("data"));
+            childSeq.add(SequenceType.create(new ElementType(nt, AnyType.INSTANCE, false), Quantifier.QUANT_ONE));
+            handler = new SAXContentHandler(false, new TreeNodeIdProvider((short) 0), null, null, childSeq);
+            parser.setContentHandler(handler);
+            parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+            return new Pair<XMLReader, SAXContentHandler>(parser, handler);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public void setDirectory(String filename) {
+        File directory = new File(filename);
+        if (directory.isDirectory()) {
+            cTestFiles = FileUtils.listFiles(directory, new VXQueryIOFileFilter(), TrueFileFilter.INSTANCE);
+            if (cTestFiles.size() < 1) {
+                System.err.println("No XML files found in given directory.");
+                return;
+            }
+        }
+        testFilesIt = cTestFiles.iterator();
+    }
+
+    public String getNextFile() {
+        if (!testFilesIt.hasNext()) {
+            testFilesIt = cTestFiles.iterator();
+        }
+        return testFilesIt.next().getAbsolutePath();
+    }
+
+    private byte[] createUTF8String(String str) {
+        ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
+        StringValueBuilder svb = new StringValueBuilder();
+        try {
+            svb.write(str, abvs.getDataOutput());
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
+        return Arrays.copyOf(abvs.getByteArray(), abvs.getLength());
+    }
+
+    public static void main(String... args) throws IOException {
+        // First Argument (XML folder)
+        if (args.length < 1) {
+            System.err.println("Please provide a directory for the test XML documents.");
+            return;
+        }
+        // Second argument (threads)
+        int threads = 1;
+        if (args.length > 1) {
+            threads = Integer.parseInt(args[1]);
+        }
+
+        // Third argument (repeat)
+        int repeat = 1;
+        if (args.length > 2) {
+            repeat = Integer.parseInt(args[2]);
+        }
+
+        // Fourth argument (buffer size)
+        int bufferSize = -1;
+        if (args.length > 3) {
+            bufferSize = Integer.parseInt(args[3]);
+        }
+
+        DiskPerformance dp = new DiskPerformance();
+        dp.setDirectory(args[0]);
+
+        ArrayList<Class> tests = new ArrayList<Class>();
+        // Character Streams
+        tests.add(ParsedBufferedCharacterStream.class);
+        tests.add(BufferedParsedCharacterStream.class);
+        tests.add(ParsedCharacterStream.class);
+        tests.add(BufferedReaderBufferedStream.class);
+        tests.add(BufferedReaderStream.class);
+        tests.add(ReaderBufferedStream.class);
+        tests.add(ReaderStream.class);
+        // Byte Streams
+        tests.add(ParsedBufferedByteStream.class);
+        tests.add(ParsedByteStream.class);
+        tests.add(BufferedStream.class);
+        tests.add(Stream.class);
+
+        System.out.println("------");
+        System.out.println("Started Test Group: " + new Date());
+        System.out.println("Thread: " + threads);
+        System.out.println("Repeat: " + repeat);
+        System.out.println("Buffer: " + bufferSize);
+        System.out.println("------");
+
+        for (Class<IDiskTest> testClass : tests) {
+            for (int r = 0; r < repeat; ++r) {
+                try {
+                    if (threads > 1) {
+                        runThreadTest(testClass, dp, threads, bufferSize);
+                    } else {
+                        IDiskTest test = testClass.newInstance();
+                        test.setFilename(dp.getNextFile());
+                        test.setBufferSize(bufferSize);
+                        test.setParser(dp.parser);
+                        test.run();
+                    }
+                } catch (InstantiationException e) {
+                    e.printStackTrace();
+                } catch (IllegalAccessException e) {
+                    e.printStackTrace();
+                }
+
+            }
+            System.out.println("------");
+        }
+
+    }
+
+    static <T> void runThreadTest(Class<T> testType, DiskPerformance dp, int threads, int bufferSize) throws InstantiationException,
+            IllegalAccessException {
+        ExecutorService es = Executors.newCachedThreadPool();
+        ArrayList<IDiskTest> threadTests = new ArrayList<IDiskTest>();
+        for (int i = 0; i < threads; ++i) {
+            threadTests.add((IDiskTest) testType.newInstance());
+        }
+        for (IDiskTest test : threadTests) {
+            test.setFilename(dp.getNextFile());
+            test.setBufferSize(bufferSize);
+            test.setParser(dp.getNewParser().first);
+            es.execute((Runnable) test);
+        }
+        es.shutdown();
+        try {
+            es.awaitTermination(60, TimeUnit.MINUTES);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        System.out.println("Completed thread batch: " + new Date());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/AbstractDiskTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/AbstractDiskTest.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/AbstractDiskTest.java
new file mode 100644
index 0000000..63d5922
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/AbstractDiskTest.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+
+import org.xml.sax.XMLReader;
+
+abstract class AbstractDiskTest implements IDiskTest, Runnable {
+    private String filename;
+    private int bufferSize;
+    protected XMLReader parser;
+
+    public AbstractDiskTest() {
+    }
+
+    public AbstractDiskTest(String filename, int bufferSize) {
+        setFilename(filename);
+        setBufferSize(bufferSize);
+    }
+
+    public void setFilename(String filename) {
+        this.filename = filename;
+    }
+
+    public void setBufferSize(int bufferSize) {
+        this.bufferSize = bufferSize;
+    }
+
+    public void setParser(XMLReader parser) {
+        this.parser = parser;
+    }
+
+    public void start() {
+        run();
+    }
+
+    public void run() {
+        OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
+        System.out.printf(filename + "\t" + getMessage() + " - Starting%n");
+        long start = System.nanoTime();
+        try {
+            long checkSum = test(filename, bufferSize);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        long end = System.nanoTime();
+        // System.out.printf("checkSum: %d%n", checkSum);
+        System.out.printf(filename + "\t" + getMessage() + "%.2f MB/s", 1024 * 1e9 / (end - start));
+        if (isBuffered() && bufferSize > 0) {
+            System.out.printf("\t%.1f KB buffer", bufferSize / 1024.0);
+        }
+        System.out.println();
+        System.out.printf("%.2f%% load average last minute%n", os.getSystemLoadAverage());
+    }
+
+    public boolean isBuffered() {
+        return true;
+    }
+
+    abstract public String getMessage();
+
+    abstract public long test(String filename, int bufferSize) throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedParsedCharacterStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedParsedCharacterStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedParsedCharacterStream.java
new file mode 100644
index 0000000..37527ae
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedParsedCharacterStream.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class BufferedParsedCharacterStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Buffered Parsed - Character Stream\t";
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        try {
+            if (bufferSize > 0) {
+                parser.setProperty("http://apache.org/xml/properties/input-buffer-size", new Integer(bufferSize));
+            }
+            InputStreamReader f = new InputStreamReader(new FileInputStream(filename));
+            InputSource in = new InputSource();
+            in.setCharacterStream(f);
+            parser.parse(in);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+        return -1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderBufferedStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderBufferedStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderBufferedStream.java
new file mode 100644
index 0000000..c553a3e
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderBufferedStream.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class BufferedReaderBufferedStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Buffered Reader - Buffered Stream\t";
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        BufferedReader f;
+        if (bufferSize > 0) {
+            f = new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream(filename),
+                    bufferSize)), bufferSize);
+        } else {
+            f = new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream(filename))));
+        }
+        int b;
+        long checkSum = 0L;
+        while ((b = f.read()) != -1)
+            checkSum += b;
+        f.close();
+        return checkSum;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderStream.java
new file mode 100644
index 0000000..20b9bab
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedReaderStream.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class BufferedReaderStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Buffered Reader - Stream\t\t";
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        BufferedReader f;
+        if (bufferSize > 0) {
+            f = new BufferedReader(new InputStreamReader(new FileInputStream(filename)), bufferSize);
+        } else {
+            f = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
+        }
+        int b;
+        long checkSum = 0L;
+        while ((b = f.read()) != -1)
+            checkSum += b;
+        f.close();
+        return checkSum;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedStream.java
new file mode 100644
index 0000000..2bf582e
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/BufferedStream.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public class BufferedStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Buffered Stream\t\t\t\t";
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        BufferedInputStream f;
+        if (bufferSize > 0) {
+            f = new BufferedInputStream(new FileInputStream(filename), bufferSize);
+        } else {
+            f = new BufferedInputStream(new FileInputStream(filename));
+        }
+        int b;
+        long checkSum = 0L;
+        while ((b = f.read()) != -1)
+            checkSum += b;
+        f.close();
+        return checkSum;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/IDiskTest.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/IDiskTest.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/IDiskTest.java
new file mode 100644
index 0000000..09ff240
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/IDiskTest.java
@@ -0,0 +1,15 @@
+package org.apache.vxquery.xtest.util.tests;
+
+import org.xml.sax.XMLReader;
+
+public interface IDiskTest {
+    public void setBufferSize(int bufferSize);
+
+    public void setFilename(String absolutePath);
+
+    public void setParser(XMLReader parser);
+
+    public void run();
+
+    public void start();
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedByteStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedByteStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedByteStream.java
new file mode 100644
index 0000000..5ae2a34
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedByteStream.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class ParsedBufferedByteStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Parsed - Buffered Byte Stream\t\t";
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        try {
+            BufferedInputStream f;
+            if (bufferSize > 0) {
+                f = new BufferedInputStream(new FileInputStream(filename), bufferSize);
+            } else {
+                f = new BufferedInputStream(new FileInputStream(filename));
+            }
+            InputSource in = new InputSource();
+            in.setByteStream(f);
+            in.setEncoding("UTF-8");
+            parser.parse(in);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+        return -1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedCharacterStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedCharacterStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedCharacterStream.java
new file mode 100644
index 0000000..c2d21d4
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedBufferedCharacterStream.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class ParsedBufferedCharacterStream extends AbstractDiskTest implements IDiskTest {
+    @Override
+    public String getMessage() {
+        return "Parsed - Buffered Character Stream\t";
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        try {
+            BufferedReader f;
+            if (bufferSize > 0) {
+                f = new BufferedReader(new InputStreamReader(new FileInputStream(filename)), bufferSize);
+            } else {
+                f = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
+            }
+            InputSource in = new InputSource();
+            in.setCharacterStream(f);
+            parser.parse(in);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+        return -1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedByteStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedByteStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedByteStream.java
new file mode 100644
index 0000000..2c8b85d
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedByteStream.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class ParsedByteStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Parsed - Byte Stream\t\t\t";
+    }
+
+    @Override
+    public boolean isBuffered() {
+        return false;
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        try {
+            InputSource in = new InputSource();
+            in.setByteStream(new FileInputStream(filename));
+            in.setEncoding("UTF-8");
+            parser.parse(in);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+        return -1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedCharacterStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedCharacterStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedCharacterStream.java
new file mode 100644
index 0000000..3dc9ed4
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ParsedCharacterStream.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class ParsedCharacterStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Parsed - Character Stream\t\t";
+    }
+
+    @Override
+    public boolean isBuffered() {
+        return false;
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        try {
+            InputStreamReader f = new InputStreamReader(new FileInputStream(filename));
+            InputSource in = new InputSource();
+            in.setCharacterStream(f);
+            parser.parse(in);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+        return -1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderBufferedStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderBufferedStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderBufferedStream.java
new file mode 100644
index 0000000..3d87f96
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderBufferedStream.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class ReaderBufferedStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Reader - Buffered Stream\t\t";
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        InputStreamReader f;
+        if (bufferSize > 0) {
+            f = new InputStreamReader(new BufferedInputStream(new FileInputStream(filename), bufferSize));
+        } else {
+            f = new InputStreamReader(new BufferedInputStream(new FileInputStream(filename)));
+        }
+        int b;
+        long checkSum = 0L;
+        while ((b = f.read()) != -1)
+            checkSum += b;
+        f.close();
+        return checkSum;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderStream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderStream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderStream.java
new file mode 100644
index 0000000..2a01275
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/ReaderStream.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+public class ReaderStream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Reader - Stream\t\t\t\t";
+    }
+
+    @Override
+    public boolean isBuffered() {
+        return false;
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        InputStreamReader f = new InputStreamReader(new FileInputStream(filename));
+        int b;
+        long checkSum = 0L;
+        while ((b = f.read()) != -1)
+            checkSum += b;
+        f.close();
+        return checkSum;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1b7d3aaf/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/Stream.java
----------------------------------------------------------------------
diff --git a/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/Stream.java b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/Stream.java
new file mode 100644
index 0000000..96e7184
--- /dev/null
+++ b/vxquery-xtest/src/main/java/org/apache/vxquery/xtest/util/tests/Stream.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.xtest.util.tests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+public class Stream extends AbstractDiskTest {
+    @Override
+    public String getMessage() {
+        return "Stream\t\t\t\t\t\t";
+    }
+
+    @Override
+    public boolean isBuffered() {
+        return false;
+    }
+
+    @Override
+    public long test(String filename, int bufferSize) throws IOException {
+        FileInputStream f = new FileInputStream(filename);
+        int b;
+        long checkSum = 0L;
+        while ((b = f.read()) != -1)
+            checkSum += b;
+        f.close();
+        return checkSum;
+    }
+}


Mime
View raw message