本文整理了Java中org.apache.commons.lang3.time.StopWatch.getNanoTime()
方法的一些代码示例,展示了StopWatch.getNanoTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StopWatch.getNanoTime()
方法的具体详情如下:
包路径:org.apache.commons.lang3.time.StopWatch
类名称:StopWatch
方法名:getNanoTime
[英]Get the time on the stopwatch in nanoseconds.
This is either the time between the start and the moment this method is called, or the amount of time between start and stop.
[中]以纳秒为单位计算秒表上的时间。
这是启动和调用此方法之间的时间,或者是启动和停止之间的时间。
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <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;
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <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);
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3
/**
* <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;
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* <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;
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* <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;
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* <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);
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3
/**
* <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);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* <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);
}
代码示例来源:origin: opencb/cellbase
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;
}
代码示例来源:origin: org.opencb.cellbase/cellbase-lib
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;
}
代码示例来源:origin: us.ihmc/robot-environment-awareness
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();
}
}
代码示例来源:origin: us.ihmc/joctomap
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.");
}
}
代码示例来源:origin: opencb/opencga
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;
}
代码示例来源:origin: us.ihmc/joctomap
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() + ").");
}
}
代码示例来源:origin: org.apache.plc4x/plc4j-scraper
latencyStatistics.addValue(stopWatch.getNanoTime());
failedStatistics.addValue(0.0);
successCounter.incrementAndGet();
代码示例来源:origin: opencb/opencga
return new QueryResult<>("", (int) watch.getNanoTime(), 1, 1, "", "", Collections.singletonList(writeResult));
代码示例来源:origin: opencb/opencga
updatesNewStudyExistingVariant + updatesWithDataExistingStudy, mongoDBOps.getMissingVariants(),
mongoDBOps.getOverlappedVariants(), mongoDBOps.getSkipped(), mongoDBOps.getNonInserted(), newVariantsTime,
existingVariants.getNanoTime(), fillGapsVariants.getNanoTime(), mongoDBOps.getGenotypes());
代码示例来源:origin: opencb/opencga
@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);
}
}
内容来源于网络,如有侵权,请联系作者删除!