List of usage examples for org.apache.commons.lang3.time StopWatch getNanoTime
public long getNanoTime()
Get the time on the stopwatch in nanoseconds.
From source file:com.github.tell.arithmetic.integer.gmp.MPZBenchmarking.java
public static void printOutRatio(final StopWatch a, final StopWatch b, final String message) { final double ratio = ((double) a.getNanoTime()) / ((double) b.getNanoTime()); System.out.printf("% 10.03f: %s%n", ratio, message); }
From source file:com.github.tell.arithmetic.integer.gmp.MPZBenchmarking.java
public static void printout(final StopWatch timer, final int length, final String name) { final double scale = 1e3; final String scaleUnit = "us"; final double nanoPart = (((double) timer.getNanoTime()) / scale) / numOfLoop; System.out.printf("% 10.03f [%s]: %s bits mul. over %s%n", nanoPart, scaleUnit, length, name); }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyClone(int[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); @SuppressWarnings("unused") int[] copy;//ww w. java 2s . com for (int i = 0; i < numIterations; ++i) { stopWatch.reset(); stopWatch.start(); copy = (int[]) array.clone(); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyClone(long[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); @SuppressWarnings("unused") long[] copy;//from ww w . java 2s.co m for (int i = 0; i < numIterations; ++i) { stopWatch.reset(); stopWatch.start(); copy = (long[]) array.clone(); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyClone(short[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); @SuppressWarnings("unused") short[] copy; for (int i = 0; i < numIterations; ++i) { stopWatch.reset();// w ww . ja v a 2 s.c o m stopWatch.start(); copy = (short[]) array.clone(); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyClone(double[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); @SuppressWarnings("unused") double[] copy; for (int i = 0; i < numIterations; ++i) { stopWatch.reset();//from w w w . j a va 2 s. c om stopWatch.start(); copy = (double[]) array.clone(); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyClone(Object[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); @SuppressWarnings("unused") Object[] copy;/* www . j a va 2 s .c o m*/ for (int i = 0; i < numIterations; ++i) { stopWatch.reset(); stopWatch.start(); copy = (Object[]) array.clone(); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyArraycopy(int[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); int[] copy = new int[array.length]; for (int i = 0; i < numIterations; ++i) { stopWatch.reset();/*from ww w.j a va 2 s . c om*/ stopWatch.start(); System.arraycopy(array, 0, copy, 0, array.length); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyClone(byte[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); @SuppressWarnings("unused") byte[] copy = null; for (int i = 0; i < numIterations; ++i) { stopWatch.reset();//ww w. j a v a2 s . com stopWatch.start(); copy = (byte[]) array.clone(); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyArraycopy(byte[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); byte[] copy = new byte[array.length]; for (int i = 0; i < numIterations; ++i) { stopWatch.reset();//from w ww . j a v a 2 s .com stopWatch.start(); System.arraycopy(array, 0, copy, 0, array.length); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }