X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=tools%2FXPathEval.java;h=d7dc54b54129500661976bb82dc08a2af342956b;hp=436ba7a3d784c7fe492e9cf015f7b8d35a5a777f;hb=9522266372edb18327f96b21213b4efc3798ee98;hpb=4e07643b4289460ed0d166e915da745e02e5ec7e diff --git a/tools/XPathEval.java b/tools/XPathEval.java index 436ba7a..d7dc54b 100644 --- a/tools/XPathEval.java +++ b/tools/XPathEval.java @@ -15,10 +15,13 @@ public class XPathEval { XPath xpath = XPathFactory.newInstance().newXPath(); String expression = args[1]; InputSource inputSource = new InputSource(args[0]); + long startTime = System.nanoTime(); NodeList nodes = (NodeList) xpath.evaluate(expression, inputSource, XPathConstants.NODESET); + long evalTime = (System.nanoTime() - startTime) / 1000000; Transformer serializer = TransformerFactory.newInstance().newTransformer(); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); StreamResult o = new StreamResult(System.out); + startTime = System.nanoTime(); System.out.println(""); for(int i = 0; i < nodes.getLength(); i++){ Node n = nodes.item(i); @@ -33,6 +36,9 @@ public class XPathEval { System.out.println(); }; System.out.println(""); + long printTime = (System.nanoTime() - startTime) / 1000000; + System.err.println("evaluation time: " + evalTime + "ms"); + System.err.println("serialization time: " + printTime + "ms"); } catch (XPathException e) { System.out.println (e.getCause()); } catch (Exception e) {