List of usage examples for java.lang System nanoTime
@HotSpotIntrinsicCandidate public static native long nanoTime();
From source file:com.springsource.insight.plugin.apache.http.hc4.HttpPlaceholderRequestTest.java
@Test public void testOnNoRequestValue() { assertSame(HttpPlaceholderRequest.PLACEHOLDER, HttpPlaceholderRequest.resolveHttpRequest("hello", Long.valueOf(System.nanoTime()))); }
From source file:me.j360.trace.server.brave.BootstrapTrace.java
private long microsSinceInit() { return (System.nanoTime() - startTick) / 1000; }
From source file:eu.fbk.utils.analysis.stemmer.AbstractStemmer.java
/** * Stems a list of terms read from the specified reader. * * @param r the reader//from ww w .j av a2s . com */ public void process(Reader r) throws IOException { long begin = 0, end = 0, time = 0; int count = 0; LineNumberReader lnr = new LineNumberReader(r); String line = null; String s = null; while ((line = lnr.readLine()) != null) { begin = System.nanoTime(); s = stem(line); end = System.nanoTime(); time += end - begin; count++; } // end while lnr.close(); logger.info(count + " total " + df.format(time) + " ns"); logger.info("avg " + df.format((double) time / count) + " ns"); }
From source file:io.adeptj.runtime.tools.DefaultTemplateEngine.java
DefaultTemplateEngine() { long startTime = System.nanoTime(); this.mustacheEngine = TemplateEngines.buildMustacheEngine(); // Can't use the static LOGGER due to enum restriction. LoggerFactory.getLogger(DefaultTemplateEngine.class).info("MustacheEngine initialized in: [{}] ms!!", Times.elapsedMillis(startTime)); }
From source file:br.upe.ecomp.doss.algorithm.abc.ABC.java
/** * Each food source are initialized./*from ww w. j a va 2 s.c om*/ */ private void initializeFoodSource(int index) { MersenneTwister mt = new MersenneTwister(System.nanoTime()); double randNumber; double fitness; double[] position = new double[dimensions]; for (int i = 0; i < dimensions; i++) { randNumber = mt.nextDouble() * 32767 / ((double) 32767 + (double) 1); position[i] = randNumber * (getProblem().getUpperBound(dimensions) - getProblem().getLowerBound(dimensions)) + getProblem().getLowerBound(dimensions); } fitness = getProblem().getFitness(position); foodSources[index] = new FoodSource(dimensions); foodSources[index].updateCurrentPosition(position, fitness); foodSources[index].updateBestPosition(position, fitness); foodSources[index].setCountStagnation(0); }
From source file:com.flexive.shared.TimestampRecorder.java
/** * Resets the timer to begin recording. */ public void begin() { timestamps.clear(); startNanos = System.nanoTime(); totalNanos = 0; }
From source file:de.zib.sfs.WrappedFSDataInputStream.java
@Override public int read() throws IOException { long startTime = System.nanoTime(); int result = this.in.read(); String datanodeHostname = getDatanodeHostNameString(); this.aggregator.aggregateReadDataOperationStatistics(OperationSource.SFS, OperationCategory.READ, startTime, System.nanoTime(), this.fd, result == -1 ? 0 : 1, this.hostname.equals(datanodeHostname) || "localhost".equals(datanodeHostname)); return result; }
From source file:com.amazonaws.util.TimingInfo.java
/** * Captures the current wall clock time (since epoch in millisecond) * and the current time (in nanosecond) used for timing measurement. * For more info, see:/*from ww w. j a v a2 s. co m*/ * https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks */ public static TimingInfo startTiming() { return new TimingInfo(Long.valueOf(System.currentTimeMillis()), System.nanoTime(), null); }
From source file:org.messic.server.api.randomlists.GenreRandomListPlugin.java
@Override public RandomList getRandomList(User user) { List<MDOGenre> randomGenreList = daoGenre.getRandomGenre(user.getLogin(), 1); if (randomGenreList != null && randomGenreList.size() > 0) { List<MDOAlbum> albumList = daoAlbum.getAll(user.getLogin(), randomGenreList.get(0)); RandomList rl = new RandomList("RandomListName-Genre", "RandomListTitle-Genre"); rl.addDetail(randomGenreList.get(0).getName()); for (int i = 0; i < albumList.size() && i < MAX_ELEMENTS; i++) { for (MDOSong mdoSong : albumList.get(i).getSongs()) { Song song = new Song(mdoSong, true, true); rl.addSong(song);//w ww .j a v a 2s. com } } long seed = System.nanoTime(); if (rl.getSongs() != null) { Collections.shuffle(rl.getSongs(), new Random(seed)); } return rl; } return null; }
From source file:com.eviware.soapui.impl.wsdl.submit.transports.http.TimeablePostMethod.java
protected void writeRequest(HttpState arg0, HttpConnection arg1) throws IOException, HttpException { super.writeRequest(arg0, arg1); if (startTime == 0) startTime = System.nanoTime(); }