You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2015/09/11 23:51:02 UTC
[1/2] vxquery git commit: Fix for issue VXQUERY-177.
Repository: vxquery
Updated Branches:
refs/heads/master 44717b267 -> ef31a814c
Fix for issue VXQUERY-177.
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/a849cdc0
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/a849cdc0
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/a849cdc0
Branch: refs/heads/master
Commit: a849cdc025799b196e1942e2700afb18261d5011
Parents: 44717b2
Author: Preston Carman <pr...@apache.org>
Authored: Fri Sep 11 11:50:08 2015 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Fri Sep 11 11:50:08 2015 -0700
----------------------------------------------------------------------
.../main/java/org/apache/vxquery/cli/VXQuery.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/a849cdc0/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 cf21c76..2a48f84 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
@@ -15,7 +15,9 @@
package org.apache.vxquery.cli;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.nio.ByteBuffer;
@@ -115,8 +117,9 @@ public class VXQuery {
timingMessage("Execution time: " + (end.getTime() - start.getTime()) + " ms");
if (opts.repeatExec > opts.timingIgnoreQueries) {
long mean = sumTiming / (opts.repeatExec - opts.timingIgnoreQueries);
- double sd = Math.sqrt(sumSquaredTiming
- / (opts.repeatExec - new Integer(opts.timingIgnoreQueries).doubleValue()) - mean * mean);
+ double sd = Math
+ .sqrt(sumSquaredTiming / (opts.repeatExec - new Integer(opts.timingIgnoreQueries).doubleValue())
+ - mean * mean);
timingMessage("Average execution time: " + mean + " ms");
timingMessage("Standard deviation: " + String.format("%.4f", sd));
timingMessage("Coefficient of variation: " + String.format("%.4f", (sd / mean)));
@@ -199,7 +202,12 @@ public class VXQuery {
DynamicContext dCtx = new DynamicContextImpl(module.getModuleContext());
js.setGlobalJobDataFactory(new VXQueryGlobalDataFactory(dCtx.createFactory()));
- PrintWriter writer = new PrintWriter(System.out, true);
+ OutputStream resultWriter = System.out;
+ if (opts.resultFile != null) {
+ resultWriter = new FileOutputStream(new File(opts.resultFile));
+ }
+
+ PrintWriter writer = new PrintWriter(resultWriter, true);
// Repeat execution for number of times provided in -repeatexec argument
for (int i = 0; i < opts.repeatExec; ++i) {
start = opts.timing ? new Date() : null;
@@ -401,6 +409,9 @@ public class VXQuery {
@Option(name = "-repeatexec", usage = "Number of times to repeat execution.")
private int repeatExec = 1;
+ @Option(name = "-result-file", usage = "File path to save the query result.")
+ private String resultFile = null;
+
@Option(name = "-timing", usage = "Produce timing information.")
private boolean timing;
[2/2] vxquery git commit: Renamed variable.
Posted by pr...@apache.org.
Renamed variable.
Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/ef31a814
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/ef31a814
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/ef31a814
Branch: refs/heads/master
Commit: ef31a814c9f607e0058354f1f91d962e11f97952
Parents: a849cdc
Author: Preston Carman <pr...@apache.org>
Authored: Fri Sep 11 11:57:00 2015 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Fri Sep 11 11:57:00 2015 -0700
----------------------------------------------------------------------
vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vxquery/blob/ef31a814/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 2a48f84..0e88539 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
@@ -202,12 +202,12 @@ public class VXQuery {
DynamicContext dCtx = new DynamicContextImpl(module.getModuleContext());
js.setGlobalJobDataFactory(new VXQueryGlobalDataFactory(dCtx.createFactory()));
- OutputStream resultWriter = System.out;
+ OutputStream resultStream = System.out;
if (opts.resultFile != null) {
- resultWriter = new FileOutputStream(new File(opts.resultFile));
+ resultStream = new FileOutputStream(new File(opts.resultFile));
}
- PrintWriter writer = new PrintWriter(resultWriter, true);
+ PrintWriter writer = new PrintWriter(resultStream, true);
// Repeat execution for number of times provided in -repeatexec argument
for (int i = 0; i < opts.repeatExec; ++i) {
start = opts.timing ? new Date() : null;