Package xbird.util

Examples of xbird.util.StopWatch


        String queryStr = IOUtils.toString(new FileInputStream(queryFilePath));
        queryStr = queryStr.replace("fn:doc(\"auction.xml\")", "fn:collection('"
                + TARGET_COLLECTION + "')");

        final StopWatch sw = new StopWatch("[Xbird_collection] " + queryFilePath);
        final XQueryProcessor processor = new XQueryProcessor();
        // parse
        XQueryModule mod = processor.parse(queryStr, new File(queryFilePath).toURI());
        // execute
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream();
View Full Code Here


            }
        }
    }

    private void execute(Reader reader, int timeout) throws XQueryException {
        final StopWatch sw = new StopWatch("elapsed time");
        if(_perfmon) {
            try {
                new PerfmonService().start();
            } catch (ServiceException e) {
                System.err.println(PrintUtils.prettyPrintStackTrace(e));
            }
        }
        if(timeout > 0) {
            TimerTask cancel = new TimerTask() {
                public void run() {
                    System.err.println("Execution Timeout: " + sw.toString());
                    System.exit(1);
                }
            };
            Timer timer = new Timer();
            timer.schedule(cancel, timeout * 1000);
            try {
                execute(reader);
            } catch (XQueryException e) {
                timer.cancel();
                throw e;
            }
            timer.cancel();
        } else {
            execute(reader);
        }
        if(_timing) {
            if(_timing_in_msec) {
                System.out.println('\n' + sw.elapsed() + " msec");
            } else {
                System.out.println();
                System.out.println(sw);
            }
        }
View Full Code Here

            }
        }
        Serializer ser = new SAXSerializer(saxwr, writer);
        Sequence<? extends Item> result = proc.execute(module);
        if(_timing) {
            final StopWatch sw = new StopWatch("print time");
            ser.emit(result);
            if(_timing_in_msec) {
                System.out.println('\n' + sw.elapsed() + " msec");
            } else {
                System.out.println();
                System.out.println(sw);
            }
        } else {
View Full Code Here

    public void loadDocument(InputStream is) throws XQueryException {
        if(!(is instanceof FastBufferedInputStream)) {
            is = new FastBufferedInputStream(is);
        }
        _handler.init();
        final StopWatch sw = new StopWatch();
        try {
            _reader.parse(new InputSource(is));
        } catch (IOException ie) {
            throw new DynamicError("Invalid source", ie);
        } catch (SAXException se) {
            throw new DynamicError("Parse failed", se);
        }
        if(LOG.isDebugEnabled()) {
            LOG.debug("Elasped time of building a DTM: " + sw.elapsed() + " msec");
        }
        this._docid = nextDocumentId();
        if(_store instanceof IProfiledDocumentTable) {
            ((IProfiledDocumentTable) _store).setProfiling(true);
        }
View Full Code Here

                throw new IllegalStateException("create collection failed: " + colpath, e);
            }
            session.setContextCollection(col);
        }
        String[] cmdArgs = arguments.toArray(new String[arguments.size()]);
        StopWatch sw = new StopWatch();
        boolean success = false;
        try {
            success = executeCommand(cmdArgs);
        } catch (CommandException e) {
            LOG.error("command failed: " + Arrays.toString(cmdArgs), e);
View Full Code Here

                        int nth = counter.getAndIncrement();
                        String testfilename = tests[nth];
                        String test = FileUtils.basename(testfilename) + "#" + nth;
                        //String[] args = new String[] { "-q", testfilename, "-o", OUTPUT_DEST + test };
                        String[] args = new String[] { "-q", testfilename, "-o", "/dev/null" };
                        StopWatch sw = new StopWatch("elapsed time of " + test);
                        try {
                            new InteractiveShell().run(args);
                        } catch (XQueryException e) {
                            Assert.fail("failed " + test, e);
                        }
View Full Code Here

TOP

Related Classes of xbird.util.StopWatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.