X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=tools%2FXPathEval.java;h=8ce8db1f15d7368d3a4007d81ea22932603cf194;hp=436ba7a3d784c7fe492e9cf015f7b8d35a5a777f;hb=4c1c49168a2ff5841a1d4fe26f99ca2776bc5a58;hpb=7c1d3641c4c5d7bde075df20863ab4242df3b763 diff --git a/tools/XPathEval.java b/tools/XPathEval.java index 436ba7a..8ce8db1 100644 --- a/tools/XPathEval.java +++ b/tools/XPathEval.java @@ -15,11 +15,14 @@ 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); - System.out.println(""); + startTime = System.nanoTime(); + System.out.println(""); for(int i = 0; i < nodes.getLength(); i++){ Node n = nodes.item(i); switch (n.getNodeType()) { @@ -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) {