public static String format(long l) { if (l == HOUR) { return "hour"; } else if (l == MINUTE) { return "minute"; } else if (l == TEN_SECOND) { return "10seconds"; } else { return PeriodFormat.getDefault().print(new Period(l)); } } }
@Override public String toString() { return "count:" + count + ", cost:" + cost + ", avgCost:" + (double) (cost.get()) / count.get() + ", duration:" + PeriodFormat.getDefault().print(new Period(duration)); }
@Override public void onSuccess( String result ) { Period timeDiff = new Period( startTime, DateTime.now() ); log.info( "File stored with key: '" + result + "'. Upload finished in " + timeDiff.toString( PeriodFormat.getDefault() ) ); } };
/** * This method is invoked when a log record is successfully sent to Kinesis. * Though this is not too useful for production use cases, it provides a good * debugging tool while tweaking parameters for the appender. */ @Override public void onSuccess(PutRecordRequest request, PutRecordResult result) { successfulRequestCount++; if (logger.isDebugEnabled() && (successfulRequestCount + failedRequestCount) % 3000 == 0) { logger.debug("Appender (" + appenderName + ") made " + successfulRequestCount + " successful put requests out of total " + (successfulRequestCount + failedRequestCount) + " in " + PeriodFormat.getDefault().print(new Period(startTime, DateTime.now())) + " since start"); } } }
/** * Returns the period in msecs */ public static long parsePeriod(String periodStr) { PeriodFormatter fmt = PeriodFormat.getDefault(); Period p = fmt.parsePeriod(periodStr); return p.toStandardDuration().getMillis(); }
private String convert(long runningDurationMillis) { Duration duration = new Duration(runningDurationMillis); PeriodFormatter formatter = PeriodFormat.getDefault(); return formatter.print(duration.toPeriod()); }
/** @return a human-readable formatted string for the given amount of nanos */ private static String formatElapsed(long nanos) { return String.format("%s (%6.3g nanoseconds)", PeriodFormat.getDefault().print(Period.millis((int)(nanos / 1000))), (double) nanos); }
/** @return a human-readable formatted string for the given amount of nanos */ private static String formatElapsed(long nanos) { return String.format("%s (%6.3g nanoseconds)", PeriodFormat.getDefault().print(Period.millis((int)(nanos / 1000))), (double) nanos); }
private void logCacheLoadTime(long startTime) { Period cacheLoadPeriod = new Period(startTime, System.currentTimeMillis()); LOGGER.info("Cache load finished in {} ({} seconds)", PeriodFormat.getDefault().print(cacheLoadPeriod.normalizedStandard()), cacheLoadPeriod.toStandardSeconds()); }
private void logCacheLoadTime(long startTime) { Period cacheLoadPeriod = new Period(startTime, System.currentTimeMillis()); LOGGER.info("Cache load finished in {} ({} seconds)", PeriodFormat.getDefault().print(cacheLoadPeriod.normalizedStandard()), cacheLoadPeriod.toStandardSeconds()); }
@Override public void receive(SimulationResult result) { if (result.getResultObject() instanceof FailureStrategy) { failures++; } else { received++; } final Duration dur = new Duration(startTime, System.currentTimeMillis()); printStream.println(Joiner.on("") .join(received, SLASH, total, " (failures: ", failures, ", duration: ", PeriodFormat.getDefault().print(dur.toPeriod()), ", memory free/total/max (M): ", memorySummary(), ")")); }
@Override public void doneComputing(ExperimentResults results) { final Duration dur = new Duration(startTime, System.currentTimeMillis()); printStream.println("Computing done, duration: " + PeriodFormat.getDefault().print(dur.toPeriod()) + "."); printMemorySummary(printStream); } }
@Override public void doneComputing(ExperimentResults results) { final Duration dur = new Duration(startTime, System.currentTimeMillis()); printStream.println("Computing done, duration: " + PeriodFormat.getDefault().print(dur.toPeriod()) + "."); printMemorySummary(printStream); } }
private static void printScriptRunTime(DateTime startTime) { DateTime endTime = new DateTime(); Duration duration = new Duration(startTime, endTime); Period period = duration.toPeriod().normalizedStandard(PeriodType.time()); log.info("Pig script completed in " + PeriodFormat.getDefault().print(period) + " (" + duration.getMillis() + " ms)"); }
@Override public void receive(SimulationResult result) { if (result.getResultObject() instanceof FailureStrategy) { failures++; } else { received++; } final Duration dur = new Duration(startTime, System.currentTimeMillis()); printStream.println(Joiner.on("") .join(received, SLASH, total, " (failures: ", failures, ", duration: ", PeriodFormat.getDefault().print(dur.toPeriod()), ", memory free/total/max (M): ", memorySummary(), ")")); }
public String format(PeriodType type) { Period period = new Period(millis()); return PeriodFormat.getDefault().withParseType(type).print(period); }
public String format(PeriodType type) { Period period = new Period(millis()); return PeriodFormat.getDefault().withParseType(type).print(period); }
public String format(PeriodType type) { Period period = new Period(millis()); return PeriodFormat.getDefault().withParseType(type).print(period); }
protected void checkTimestamp(WindowedValue<IN> ref, Instant timestamp) { if (timestamp.isBefore(ref.getTimestamp().minus(doFn.getAllowedTimestampSkew()))) { throw new IllegalArgumentException(String.format( "Cannot output with timestamp %s. Output timestamps must be no earlier than the " + "timestamp of the current input (%s) minus the allowed skew (%s). See the " + "DoFn#getAllowedTimestmapSkew() Javadoc for details on changing the allowed skew.", timestamp, ref.getTimestamp(), PeriodFormat.getDefault().print(doFn.getAllowedTimestampSkew().toPeriod()))); } }
public static void main(String[] args) throws Exception { OWLOntologyManager man = OWLManager.createOWLOntologyManager(); OWLOntology schema = //man.loadOntology(IRI.create("http://downloads.dbpedia.org/2016-10/dbpedia_2016-10.nt")); man.loadOntology(IRI.create("file:///tmp/merged.ttl")); OWLOntologyKnowledgeSource sampleKS = new OWLAPIOntology(schema); sampleKS.init(); final long start = System.currentTimeMillis(); OWLAPIReasoner baseReasoner = new OWLAPIReasoner(sampleKS); baseReasoner.setReasonerImplementation(ReasonerImplementation.STRUCTURAL); baseReasoner.init(); ClosedWorldReasoner reasoner = new ClosedWorldReasoner(baseReasoner); reasoner.init(); System.out.println(PeriodFormat.getDefault().print(new Period(System.currentTimeMillis() - start))); }