/** * <p> * Get the time on the stopwatch. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. * </p> * * @return the time in milliseconds */ public long getTime() { return getNanoTime() / NANO_2_MILLIS; }
/** * <p> * Get the time on the stopwatch in the specified TimeUnit. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. The resulting time will be expressed in the desired TimeUnit with any remainder rounded down. * For example, if the specified unit is {@code TimeUnit.HOURS} and the stopwatch time is 59 minutes, then the * result returned will be {@code 0}. * </p> * * @param timeUnit the unit of time, not null * @return the time in the specified TimeUnit, rounded down * @since 3.5 */ public long getTime(final TimeUnit timeUnit) { return timeUnit.convert(getNanoTime(), TimeUnit.NANOSECONDS); }
/** * <p> * Get the time on the stopwatch. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. * </p> * * @return the time in milliseconds */ public long getTime() { return getNanoTime() / NANO_2_MILLIS; }
/** * <p> * Get the time on the stopwatch. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. * </p> * * @return the time in milliseconds */ public long getTime() { return getNanoTime() / NANO_2_MILLIS; }
/** * <p> * Get the time on the stopwatch. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. * </p> * * @return the time in milliseconds */ public long getTime() { return getNanoTime() / NANO_2_MILLIS; }
/** * <p> * Get the time on the stopwatch in the specified TimeUnit. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. The resulting time will be expressed in the desired TimeUnit with any remainder rounded down. * For example, if the specified unit is {@code TimeUnit.HOURS} and the stopwatch time is 59 minutes, then the * result returned will be {@code 0}. * </p> * * @param timeUnit the unit of time, not null * @return the time in the specified TimeUnit, rounded down * @since 3.5 */ public long getTime(final TimeUnit timeUnit) { return timeUnit.convert(getNanoTime(), TimeUnit.NANOSECONDS); }
/** * <p> * Get the time on the stopwatch in the specified TimeUnit. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. The resulting time will be expressed in the desired TimeUnit with any remainder rounded down. * For example, if the specified unit is {@code TimeUnit.HOURS} and the stopwatch time is 59 minutes, then the * result returned will be {@code 0}. * </p> * * @param timeUnit the unit of time, not null * @return the time in the specified TimeUnit, rounded down * @since 3.5 */ public long getTime(final TimeUnit timeUnit) { return timeUnit.convert(getNanoTime(), TimeUnit.NANOSECONDS); }
/** * <p> * Get the time on the stopwatch in the specified TimeUnit. * </p> * * <p> * This is either the time between the start and the moment this method is called, or the amount of time between * start and stop. The resulting time will be expressed in the desired TimeUnit with any remainder rounded down. * For example, if the specified unit is {@code TimeUnit.HOURS} and the stopwatch time is 59 minutes, then the * result returned will be {@code 0}. * </p> * * @param timeUnit the unit of time, not null * @return the time in the specified TimeUnit, rounded down * @since 3.5 */ public long getTime(final TimeUnit timeUnit) { return timeUnit.convert(getNanoTime(), TimeUnit.NANOSECONDS); }
private String getPingResponseTime(String memberName) { try { StopWatch uptime = new StopWatch(); uptime.start(); InetAddress address = InetAddress.getByName(memberName); boolean chkConnection = address.isReachable(1000); if (chkConnection) { return String.valueOf(TimeUnit.NANOSECONDS.toMillis(uptime.getNanoTime())) + "ms"; } } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
private String getPingResponseTime(String memberName) { try { StopWatch uptime = new StopWatch(); uptime.start(); InetAddress address = InetAddress.getByName(memberName); boolean chkConnection = address.isReachable(1000); if (chkConnection) { return String.valueOf(TimeUnit.NANOSECONDS.toMillis(uptime.getNanoTime())) + "ms"; } } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
public void run(Runnable command, String timeReportPrefix) { if (reportTimeEnabled.get()) { StopWatch stopWatch = stopWatchLocal.get(); stopWatch.reset(); stopWatch.start(); command.run(); long nanoTime = stopWatch.getNanoTime(); if (nanoTime > minimumNanoTimeToReport.get()) LogTools.info(timeReportPrefix + Conversions.nanosecondsToSeconds(nanoTime)); } else command.run(); } }
public void updateNodesNormals(Collection<NormalOcTreeNode> nodesToUpdate, NormalEstimationParameters normalEstimationParameters) { if (reportTime) { stopWatch.reset(); stopWatch.start(); } Stream<NormalOcTreeNode> nodeStream = computeNormalsInParallel ? nodesToUpdate.parallelStream() : nodesToUpdate.stream(); nodeStream.forEach(node -> NormalEstimationTools.computeNodeNormalRansac(root, node, normalEstimationParameters)); if (root != null) updateInnerNormalsRecursive(root, 0); if (reportTime) { System.out.println(name + ": Normal computation took: " + JOctoMapTools.nanoSecondsToSeconds(stopWatch.getNanoTime()) + " sec."); } }
static VariantMongoDBIterator persistentIterator(MongoDBCollection collection, Bson query, Bson projection, QueryOptions options, DocumentToVariantConverter converter) { StopWatch watch = StopWatch.createStarted(); MongoPersistentCursor cursor = new MongoPersistentCursor(collection, query, projection, options); VariantMongoDBIterator iterator = new VariantMongoDBIterator(cursor, converter); iterator.timeFetching += watch.getNanoTime(); return iterator; }
public void insertScanCollection(ScanCollection scanCollection, boolean insertMiss, Set<NormalOcTreeNode> updatedLeavesToPack, Set<OcTreeKey> deletedLeavesToPack) { if (reportTime) { stopWatch.reset(); stopWatch.start(); } scanCollection.forEach(scan -> insertScan(scan, insertMiss, updatedLeavesToPack, deletedLeavesToPack)); if (reportTime) { System.out.println(name + ": ScanCollection integration took: " + JOctoMapTools.nanoSecondsToSeconds(stopWatch.getNanoTime()) + " sec. (number of points: " + scanCollection.getNumberOfPoints() + ")."); } }
latencyStatistics.addValue(stopWatch.getNanoTime()); failedStatistics.addValue(0.0); successCounter.incrementAndGet();
return new QueryResult<>("", (int) watch.getNanoTime(), 1, 1, "", "", Collections.singletonList(writeResult));
updatesNewStudyExistingVariant + updatesWithDataExistingStudy, mongoDBOps.getMissingVariants(), mongoDBOps.getOverlappedVariants(), mongoDBOps.getSkipped(), mongoDBOps.getNonInserted(), newVariantsTime, existingVariants.getNanoTime(), fillGapsVariants.getNanoTime(), mongoDBOps.getGenotypes());
@Override public VariantDBIterator iterator(Query query, QueryOptions options) { if (query == null) { query = new Query(); } if (options == null) { options = new QueryOptions(); } SelectVariantElements selectVariantElements = VariantQueryUtils.parseSelectElements(query, options, studyConfigurationManager); Document mongoQuery = queryParser.parseQuery(query); Document projection = queryParser.createProjection(query, options, selectVariantElements); DocumentToVariantConverter converter = getDocumentToVariantConverter(query, selectVariantElements); options.putIfAbsent(MongoDBCollection.BATCH_SIZE, 100); // Short unsorted queries with timeout or limit don't need the persistent cursor. if (options.containsKey(QueryOptions.TIMEOUT) || options.containsKey(QueryOptions.LIMIT) || !options.getBoolean(QueryOptions.SORT, false)) { StopWatch stopWatch = StopWatch.createStarted(); FindIterable<Document> dbCursor = variantsCollection.nativeQuery().find(mongoQuery, projection, options); VariantMongoDBIterator dbIterator = new VariantMongoDBIterator(dbCursor, converter); dbIterator.setTimeFetching(dbIterator.getTimeFetching() + stopWatch.getNanoTime()); return dbIterator; } else { logger.debug("Using mongodb persistent iterator"); return VariantMongoDBIterator.persistentIterator(variantsCollection, mongoQuery, projection, options, converter); } }