@Override public boolean isCanceled() { final long elapsedTime = _timer.getElapsed(); return elapsedTime > _limit; } }
@Deprecated public String calcElapsedTime() { return DurationFormat.SHORT.format(_timer.getElapsed()); }
@Deprecated public String calcElapsedTime() { return DurationFormat.SHORT.format(_timer.getElapsed()); }
@Override protected void updateProgress() { final int pc = (int) (100.0 * _progress / _progressLength); if (pc == _progressPercent) return; _progressPercent = pc; if (pc < _echo) return; _echo += getEchoInterval(); // delete the previous line _out.print('\r'); // print the new message _out.print(_progressTitle); _out.print(": "); _out.print(_progressMessage); _out.print(" "); _out.print(_progressPercent); _out.print("% complete in "); _out.print(DurationFormat.SHORT.format(_timer.getElapsed())); }
@Override protected void updateProgress() { final int pc = (int) (100.0 * _progress / _progressLength); if (pc == _progressPercent) return; _progressPercent = pc; if (pc < _echo) return; _echo += getEchoInterval(); // delete the previous line _out.print('\r'); // print the new message _out.print(_progressTitle); _out.print(": "); _out.print(_progressMessage); _out.print(" "); _out.print(_progressPercent); _out.print("% complete in "); _out.print(DurationFormat.SHORT.format(_timer.getElapsed())); }
public String format() { return DurationFormat.LONG.format(getTotal() + getElapsed()); } }
public String format() { return DurationFormat.LONG.format(getTotal() + getElapsed()); } }
public void execQuery(final Query query) { System.out.print("Running SPARQL query..."); // we need to restart the timer as above timers._mainTimer.restart(); try { // run the SPARQL query final ResultSet results = SparqlDLExecutionFactory.create(query, model).execSelect(); final int size = ResultSetFormatter.consume(results); System.out.print("completed in " + timers._mainTimer.getElapsed() + "ms"); System.out.println(" (" + size + " results)"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers._mainTimer.getElapsed() + "ms"); } } }
public void execQuery(final Query query) { System.out.print("Running SPARQL query..."); // we need to restart the timer as above timers._mainTimer.restart(); try { // run the SPARQL query final ResultSet results = SparqlDLExecutionFactory.create(query, model).execSelect(); final int size = ResultSetFormatter.consume(results); System.out.print("completed in " + timers._mainTimer.getElapsed() + "ms"); System.out.println(" (" + size + " results)"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers._mainTimer.getElapsed() + "ms"); } } }
public void getInstances(final Resource cls) { System.out.print("Retrieving instances of " + cls.getLocalName() + "..."); // we need to restart the timer every time because timeouts are checked // w.r.t. the time a timer was started. not resetting the timer will // cause timeout exceptions nearly all the time timers._mainTimer.restart(); try { // run a simple query using Jena interface final ExtendedIterator<?> results = model.listIndividuals(cls); // print if the query succeeded final int size = results.toList().size(); System.out.print("completed in " + timers._mainTimer.getElapsed() + "ms"); System.out.println(" (" + size + " results)"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers._mainTimer.getElapsed() + "ms"); } }
public void getInstances(final Resource cls) { System.out.print("Retrieving instances of " + cls.getLocalName() + "..."); // we need to restart the timer every time because timeouts are checked // w.r.t. the time a timer was started. not resetting the timer will // cause timeout exceptions nearly all the time timers._mainTimer.restart(); try { // run a simple query using Jena interface final ExtendedIterator<?> results = model.listIndividuals(cls); // print if the query succeeded final int size = results.toList().size(); System.out.print("completed in " + timers._mainTimer.getElapsed() + "ms"); System.out.println(" (" + size + " results)"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers._mainTimer.getElapsed() + "ms"); } }
public void classify() { System.out.println("Classify Timeout: " + Timeouts.CLASSIFY + "ms"); System.out.print("Classifying..."); try { ((PelletInfGraph) model.getGraph()).classify(); System.out.println("finished in " + timers.getTimer("classify").get().getLast() + "ms"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers.getTimer("classify").get().getElapsed() + "ms"); } System.out.println("Classified: " + openllet.isClassified()); System.out.println(); }
public void classify() { System.out.println("Classify Timeout: " + Timeouts.CLASSIFY + "ms"); System.out.print("Classifying..."); try { ((PelletInfGraph) model.getGraph()).classify(); System.out.println("finished in " + timers.getTimer("classify").get().getLast() + "ms"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers.getTimer("classify").get().getElapsed() + "ms"); } System.out.println("Classified: " + openllet.isClassified()); System.out.println(); }
public void realize() { // realization can only be done if classification is completed if (!openllet.isClassified()) return; System.out.println("Realize Timeout: " + Timeouts.REALIZE + "ms"); System.out.print("Realizing..."); try { openllet.realize(); System.out.println("finished in " + timers.getTimer("realize").get().getLast() + "ms"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers.getTimer("realize").get().getElapsed() + "ms"); } System.out.println("Realized: " + openllet.isRealized()); System.out.println(); }
public void realize() { // realization can only be done if classification is completed if (!openllet.isClassified()) return; System.out.println("Realize Timeout: " + Timeouts.REALIZE + "ms"); System.out.print("Realizing..."); try { openllet.realize(); System.out.println("finished in " + timers.getTimer("realize").get().getLast() + "ms"); } catch (final TimeoutException e) { Log.error(_logger, e); System.out.println("interrupted after " + timers.getTimer("realize").get().getElapsed() + "ms"); } System.out.println("Realized: " + openllet.isRealized()); System.out.println(); }
long t2 = o2.getTotal(); if (t1 == 0) t1 = o1.getElapsed(); if (t2 == 0) t2 = o2.getElapsed(); return (int) (t2 - t1); row.add(String.valueOf(timer.getElapsed())); else row.add(String.valueOf(timer.getTotal()));
long t2 = o2.getTotal(); if (t1 == 0) t1 = o1.getElapsed(); if (t2 == 0) t2 = o2.getElapsed(); return (int) (t2 - t1); row.add(String.valueOf(timer.getElapsed())); else row.add(String.valueOf(timer.getTotal()));
/** * Check if the elapsed time is greater than the timeout limit and throw a TimeoutException if that is the case. Check the parent timer if there is one. * * @throws TimeoutException * @throws TimerInterruptedException */ public void check() throws TimeoutException, TimerInterruptedException { if (interrupted) { interrupted = false; throw new TimerInterruptedException("Timer " + getName() + " interrupted."); } final long elapsed = getElapsed(); if (_timeout != NO_TIMEOUT && elapsed > _timeout) throw new TimeoutException("Running time of " + _name + " exceeded timeout of " + _timeout); if (_parent != null) _parent.check(); }
/** * Check if the elapsed time is greater than the timeout limit and throw a TimeoutException if that is the case. Check the parent timer if there is one. * * @throws TimeoutException * @throws TimerInterruptedException */ public void check() throws TimeoutException, TimerInterruptedException { if (interrupted) { interrupted = false; throw new TimerInterruptedException("Timer " + getName() + " interrupted."); } final long elapsed = getElapsed(); if (_timeout != NO_TIMEOUT && elapsed > _timeout) throw new TimeoutException("Running time of " + _name + " exceeded timeout of " + _timeout); if (_parent != null) _parent.check(); }
private static QueryResult runSingleTest(final Query query) { final Timer t = new Timer("Single _query execution"); t.start(); final QueryResult bindings = QueryEngine.exec(query); _logger.info("Execution time=" + t.getElapsed()); t.stop(); _logger.info("Result size = " + bindings.size()); return bindings; }