diff -r 33a1639d64a5 -r bda219d843f6 jdk/test/java/rmi/reliability/benchmark/bench/serial/LongArrays.java --- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/LongArrays.java Tue Apr 01 15:14:53 2008 -0700 +++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/LongArrays.java Tue Apr 01 15:41:23 2008 -0700 @@ -1,4 +1,4 @@ -/* +/* * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,7 +35,7 @@ * Benchmark for testing speed of long array reads/writes. */ public class LongArrays implements Benchmark { - + /** * Write and read long arrays to/from a stream. The benchmark is run in * batches, with each batch consisting of a fixed number of read/write @@ -44,44 +44,42 @@ * Arguments: <# batches> <# cycles per batch> */ public long run(String[] args) throws Exception { - int size = Integer.parseInt(args[0]); - int nbatches = Integer.parseInt(args[1]); - int ncycles = Integer.parseInt(args[2]); - long[][] arrays = new long[ncycles][size]; - StreamBuffer sbuf = new StreamBuffer(); - ObjectOutputStream oout = - new ObjectOutputStream(sbuf.getOutputStream()); - ObjectInputStream oin = - new ObjectInputStream(sbuf.getInputStream()); + int size = Integer.parseInt(args[0]); + int nbatches = Integer.parseInt(args[1]); + int ncycles = Integer.parseInt(args[2]); + long[][] arrays = new long[ncycles][size]; + StreamBuffer sbuf = new StreamBuffer(); + ObjectOutputStream oout = + new ObjectOutputStream(sbuf.getOutputStream()); + ObjectInputStream oin = + new ObjectInputStream(sbuf.getInputStream()); - doReps(oout, oin, sbuf, arrays, 1); // warmup + doReps(oout, oin, sbuf, arrays, 1); // warmup - long start = System.currentTimeMillis(); - doReps(oout, oin, sbuf, arrays, nbatches); + long start = System.currentTimeMillis(); + doReps(oout, oin, sbuf, arrays, nbatches); return System.currentTimeMillis() - start; } - + /** * Run benchmark for given number of batches, with given number of cycles * for each batch. */ void doReps(ObjectOutputStream oout, ObjectInputStream oin, - StreamBuffer sbuf, long[][] arrays, int nbatches) - throws Exception + StreamBuffer sbuf, long[][] arrays, int nbatches) + throws Exception { - int ncycles = arrays.length; - for (int i = 0; i < nbatches; i++) { - sbuf.reset(); - oout.reset(); - for (int j = 0; j < ncycles; j++) { - oout.writeObject(arrays[j]); - } - oout.flush(); - for (int j = 0; j < ncycles; j++) { - oin.readObject(); - } - } + int ncycles = arrays.length; + for (int i = 0; i < nbatches; i++) { + sbuf.reset(); + oout.reset(); + for (int j = 0; j < ncycles; j++) { + oout.writeObject(arrays[j]); + } + oout.flush(); + for (int j = 0; j < ncycles; j++) { + oin.readObject(); + } + } } } - -