List of usage examples for java.util.concurrent TimeUnit NANOSECONDS
TimeUnit NANOSECONDS
To view the source code for java.util.concurrent TimeUnit NANOSECONDS.
Click Source Link
From source file:io.anserini.index.IndexClueWeb09b.java
public static void main(String[] args) throws IOException, InterruptedException { IndexArgs indexArgs = new IndexArgs(); CmdLineParser parser = new CmdLineParser(indexArgs, ParserProperties.defaults().withUsageWidth(90)); try {/*from w w w .j a v a 2 s . c o m*/ parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example: IndexClueWeb09b" + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } final long start = System.nanoTime(); IndexClueWeb09b indexer = new IndexClueWeb09b(indexArgs.input, indexArgs.index); indexer.setPositions(indexArgs.positions); indexer.setOptimize(indexArgs.optimize); indexer.setDocLimit(indexArgs.doclimit); LOG.info("Index path: " + indexArgs.index); LOG.info("Threads: " + indexArgs.threads); LOG.info("Positions: " + indexArgs.positions); LOG.info("Optimize (merge segments): " + indexArgs.optimize); LOG.info("Doc limit: " + (indexArgs.doclimit == -1 ? "all docs" : "" + indexArgs.doclimit)); LOG.info("Indexer: start"); int numIndexed = indexer.indexWithThreads(indexArgs.threads); final long durationMillis = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS); LOG.info("Total " + numIndexed + " documents indexed in " + DurationFormatUtils.formatDuration(durationMillis, "HH:mm:ss")); }
From source file:org.z.global.util.TimeValue.java
public static TimeValue timeValueNanos(long nanos) { return new TimeValue(nanos, TimeUnit.NANOSECONDS); }
From source file:io.anserini.search.SearchCollection.java
public static void main(String[] args) throws Exception { SearchArgs searchArgs = new SearchArgs(); CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90)); try {//from ww w .j a v a2 s. co m parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example: SearchCollection" + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } final long start = System.nanoTime(); SearchCollection searcher = new SearchCollection(searchArgs); int numTopics = searcher.runTopics(); searcher.close(); final long durationMillis = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS); LOG.info("Total " + numTopics + " topics searched in " + DurationFormatUtils.formatDuration(durationMillis, "HH:mm:ss")); }
From source file:com.relicum.ipsum.Utils.Profiler.java
public static long getCurrentDelta(String id, TimeUnit unit) { return unit.convert(getCurrentDelta(id), TimeUnit.NANOSECONDS); }
From source file:com.l2jfree.util.concurrent.ExecuteWrapper.java
public static void execute(Runnable runnable, long maximumRuntimeInMillisecWithoutWarning) { long begin = System.nanoTime(); try {/*from w w w. ja va 2 s . c om*/ runnable.run(); } catch (RuntimeException e) { _log.warn("Exception in a Runnable execution:", e); } finally { long runtimeInNanosec = System.nanoTime() - begin; Class<? extends Runnable> clazz = runnable.getClass(); RunnableStatsManager.handleStats(clazz, runtimeInNanosec); long runtimeInMillisec = TimeUnit.NANOSECONDS.toMillis(runtimeInNanosec); if (runtimeInMillisec > maximumRuntimeInMillisecWithoutWarning) { L2TextBuilder tb = L2TextBuilder.newInstance(); tb.append(clazz); tb.append(" - execution time: "); tb.append(runtimeInMillisec); tb.append("msec"); _log.warn(tb.moveToString()); } } }
From source file:com.dgtlrepublic.model.test.DataTest.java
@Test public void validateParsingResults() throws Exception { List<Map> testCases = new ObjectMapper().readValue( new File(DataTest.class.getResource("/test-cases.json").getPath()), new TypeReference<List<Map>>() { });/*from www. j a v a 2 s . c om*/ System.out.println(String.format("Loaded %s test cases.", testCases.size())); long start = System.nanoTime(); for (Map testCase : testCases) { verify(testCase); } System.out.println( String.format("Tests took: %s(ms)", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start))); }
From source file:com.relicum.ipsum.Utils.Profiler.java
public static long endProfiling(String id, TimeUnit unit) { return unit.convert(endProfiling(id), TimeUnit.NANOSECONDS); }
From source file:org.apache.htrace.impl.RateLimitedLogger.java
public void warn(String what) { long now = TimeUnit.MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS); synchronized (this) { if (now >= lastLogTimeMs + timeoutMs) { log.warn(what);// w w w. j a v a 2 s. co m lastLogTimeMs = now; } } }
From source file:com.nesscomputing.quartz.QuartzJobStatistics.java
void registerRuntime(final long nanos) { runtime.update(nanos, TimeUnit.NANOSECONDS); }
From source file:com.ryantenney.metrics.spring.reporter.AbstractScheduledReporterFactoryBean.java
@Override public void start() { if (!isRunning()) { getObject().start(getPeriod(), TimeUnit.NANOSECONDS); running = true; } }