// taken from paper Microbenchmarks in Java and C# public static double[] Mark3(int[] A, int[] B, int[] C, int Size, int Size1d, int n, int count) { double[] result = new double[n]; double dummy = 0.0; for (int j=0; j<n; j++) { Timer t = new Timer(); for (int i=0; i<count; i++) { dummy += MA(A,B,C,Size, Size1d); } double time = t.Check() / count; result[j] = time; } return result; }
public static double[] Mark4(int[] A, int[] B, int[] C, int Size, int Size1d, int n, int count) { double dummy = 0.0; double st = 0.0, sst = 0.0; for (int j = 0; j < n; j++) { Timer t = new Timer(); for (int i = 0; i < count; i++) dummy += MA(A, B, C, Size, Size1d); double time = t.Check() / count; st += time; sst += time * time; } double mean = st / n, sdev = Math.Sqrt((sst - mean * mean * n) / (n - 1)); return new double[2] { mean, sdev }; }