List of usage examples for java.lang System nanoTime
@HotSpotIntrinsicCandidate public static native long nanoTime();
From source file:org.jimsey.projects.turbine.condenser.service.Ping.java
public long ping() { return System.nanoTime(); }
From source file:com.arkatay.yada.base.Time.java
/** * Returns the current value of the most precise available system timer in * nanoseconds. This method can only be used to measure elapsed time and is * related to any other notion of system or wall-clock time. The value * returned represents nanoseconds since some fixed but arbitrary time * (perhaps in the future, so values may be negative). * * @return current value of the most precise available system timer in nanoseconds *//*from w w w.j a v a2 s .c o m*/ public static long getNanos() { if (useNanoTimeMethod) return System.nanoTime(); return (System.currentTimeMillis() - initTimeMillis) * 1000000L; }
From source file:org.apache.sling.distribution.it.DistributionPackageExporterImporterTest.java
@Test public void testAddExportImport() throws Exception { String nodePath = createRandomNode(publishClient, "/content/export_" + System.nanoTime()); assertExists(publishClient, nodePath); String content = doExport(publish, "default", DistributionRequestType.ADD, nodePath); publishClient.delete(nodePath);/*from w w w . jav a 2s. c om*/ assertNotExists(publishClient, nodePath); doImport(publish, "default", content.getBytes(HTTP.DEFAULT_CONTENT_CHARSET)); assertExists(publishClient, nodePath); }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.Timing.java
/** * Stops the timer with the specified name. * //from ww w .ja va 2 s . co m * @param name the name of the timer to stop */ public static void stopTimer(String name) { long stopTime = System.nanoTime(); Long startTime = openTimers.remove(name); if (startTime == null) { throw new IllegalArgumentException("timer does not exist"); } SummaryStatistics statistics = data.get(name); if (statistics == null) { statistics = new SummaryStatistics(); data.put(name, statistics); } statistics.addValue(stopTime - startTime); }
From source file:ispok.bo.Employee.java
public Employee(EmployeeDto employeeDto) { this.username = employeeDto.getUsername(); this.salt = hashProvider.computeHash(System.nanoTime() + ""); this.password = hashProvider.computeHash(employeeDto.getPassword() + salt); this.isReceptionist = employeeDto.isReceptionist(); this.isCashier = employeeDto.isCashier(); this.isFloorman = employeeDto.isFloorman(); this.isManager = employeeDto.isManager(); }
From source file:com.sirti.microservice.hbase.service.UnicoStoricoService.java
public UnicoStoricoResultSet findFilterAlarms(String filter) { UnicoStoricoResultSet hkpiresultset = new UnicoStoricoResultSet(); try {//from ww w .ja v a 2 s .c om long starttime = System.nanoTime(); List<UnicoStorico> hkpilist = unicoStoricoDao.findFilterUnicoStorico(filter); long endtime = System.nanoTime(); hkpiresultset.setList(hkpilist); hkpiresultset.setDuration((endtime - starttime) / 1000000); hkpiresultset.setError(Boolean.FALSE); } catch (Exception e) { hkpiresultset.setError(Boolean.TRUE); hkpiresultset.setErrorMsg(e.getLocalizedMessage()); } return hkpiresultset; }
From source file:com.hotmart.hot.uploader.model.FileMetaInfoRepository.java
public void saveChunk(ChunkMetaInfo chunkMetaInfo, InputStream chunkStream) throws IOException { long startTime = System.nanoTime(); FileMetaInfo fileMetaInfo = getFileMetaInfo(chunkMetaInfo.getFileMD5()); if (fileMetaInfo == null) { fileMetaInfo = new FileMetaInfo(chunkMetaInfo); putFileMetaInfo(fileMetaInfo);/*from www . jav a 2s .c om*/ } FileUtils.copyInputStreamToFile(chunkStream, chunkMetaInfo.getFile()); fileMetaInfo.addChunk(chunkMetaInfo); long endTime = System.nanoTime(); fileMetaInfo.addElapsedTime((endTime - startTime) / 1000000); }
From source file:dk.statsbiblioteket.netark.dvenabler.wrapper.DVAtomicReader.java
@Override public FieldInfos getFieldInfos() { log.info("Merging getFieldInfos called with " + maxDoc() + " docs"); long startTime = System.nanoTime(); FieldInfos original = super.getFieldInfos(); FieldInfo[] modified = new FieldInfo[original.size()]; int index = 0; for (FieldInfo oInfo : original) { modified[index++] = dvConfigs.containsKey(oInfo.name) ? dvConfigs.get(oInfo.name).getFieldInfo() : oInfo;//from w ww .jav a2 s.co m } /*FieldInfo mInfo = new FieldInfo( oInfo.name, oInfo.isIndexed(), oInfo.number, oInfo.hasVectors(), oInfo.omitsNorms(), oInfo.hasPayloads(), oInfo.getIndexOptions(), mDocValuesType, oInfo.getNormType(), oInfo.attributes()); */ log.info("Merged " + original.size() + " original and " + dvConfigs.size() + " tweaked FieldInfos for " + maxDoc() + " docs in " + (System.nanoTime() - startTime) / 1000000 + "ms"); return new FieldInfos(modified); }
From source file:gov.nasa.ensemble.common.event.ModelChangeEvent.java
/** * @param source/*from w w w.ja v a 2 s. com*/ * @param field * @param oldValue * @param newValue */ public ModelChangeEvent(Object source, Enum<?> field, Object oldValue, Object newValue) { super(source); this.field = field; this.oldValue = oldValue; this.newValue = newValue; this.time = System.nanoTime(); }
From source file:ch.algotrader.util.metric.MetricsUtil.java
/** * account the given metric by its {@code startMillis}. The endTime is taken from the system clock. * The name of the metric will be a combination of {@code metricName} and {@code clazz}. *//*w w w . j a v a 2 s .co m*/ public static void accountEnd(String metricName, Class<?> clazz, long startMillis) { if (isMetricsEnabled) { account(metricName + "." + ClassUtils.getShortClassName(clazz), System.nanoTime() - startMillis); } }