List of usage examples for org.apache.commons.lang3.time StopWatch reset
public void reset()
Resets the stopwatch.
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(); stopWatch.start();/* w w w .j a va 2 s.c om*/ 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 copyNative(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(); stopWatch.start();/*from w w w . j a va2s . c o m*/ NativeCopy.copyNative(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 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(); stopWatch.start();/* w ww . ja va2 s .c o m*/ 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 copyNative(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(); stopWatch.start();/*from www . j a v a 2s . c om*/ NativeCopy.copyNative(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 copyForLoop(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(); stopWatch.start();/*from w w w .j av a 2s.c o m*/ for (int l = 0; l < array.length; ++l) { copy[l] = array[l]; } stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyArraycopy(long[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); long[] copy = new long[array.length]; for (int i = 0; i < numIterations; ++i) { stopWatch.reset(); stopWatch.start();/*from www. j a v a 2s . c o m*/ 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 copyNative(long[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); long[] copy = new long[array.length]; for (int i = 0; i < numIterations; ++i) { stopWatch.reset(); stopWatch.start();// w w w . j av a2 s . c o m NativeCopy.copyNative(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 copyForLoop(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(); stopWatch.start();//from ww w .ja v a 2s .co m for (int l = 0; l < array.length; ++l) { copy[l] = array[l]; } stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }
From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java
private static BenchResult copyArraycopy(short[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); short[] copy = new short[array.length]; for (int i = 0; i < numIterations; ++i) { stopWatch.reset(); stopWatch.start();//w w w . ja v a 2 s. c o m 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 copyNative(short[] array, int numIterations) { BenchResult result = new BenchResult(); StopWatch stopWatch = new StopWatch(); short[] copy = new short[array.length]; for (int i = 0; i < numIterations; ++i) { stopWatch.reset(); stopWatch.start();//from w w w .j a va2 s .c o m NativeCopy.copyNative(array, 0, copy, 0, array.length); stopWatch.stop(); result.add(stopWatch.getNanoTime()); } return result; }