jdk/test/java/rmi/reliability/benchmark/bench/serial/CustomDefaultObjTrees.java
changeset 309 bda219d843f6
parent 2 90ce3da70b43
child 715 f16baef3a20e
--- a/jdk/test/java/rmi/reliability/benchmark/bench/serial/CustomDefaultObjTrees.java	Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/reliability/benchmark/bench/serial/CustomDefaultObjTrees.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.
  *
@@ -39,19 +39,19 @@
  * defaultWriteObject() and defaultReadObject().
  */
 public class CustomDefaultObjTrees implements Benchmark {
-    
+
     static class Node implements Serializable {
         boolean z;
-	byte b;
-	char c;
-	short s;
-	int i;
-	float f;
-	long j;
-	double d;
-	String str = "bodega";
+        byte b;
+        char c;
+        short s;
+        int i;
+        float f;
+        long j;
+        double d;
+        String str = "bodega";
         Object parent, left, right;
-        
+
         Node(Object parent, int depth) {
             this.parent = parent;
             if (depth > 0) {
@@ -61,13 +61,13 @@
         }
 
         private void writeObject(ObjectOutputStream out) throws IOException {
-	    out.defaultWriteObject();
+            out.defaultWriteObject();
         }
-        
-        private void readObject(ObjectInputStream in) 
+
+        private void readObject(ObjectInputStream in)
             throws IOException, ClassNotFoundException
         {
-	    in.defaultReadObject();
+            in.defaultReadObject();
         }
     }
 
@@ -79,20 +79,20 @@
      * Arguments: <tree depth> <# batches> <# cycles per batch>
      */
     public long run(String[] args) throws Exception {
-	int depth = Integer.parseInt(args[0]);
-	int nbatches = Integer.parseInt(args[1]);
-	int ncycles = Integer.parseInt(args[2]);
-	Node[] trees = genTrees(depth, ncycles);
-	StreamBuffer sbuf = new StreamBuffer();
-	ObjectOutputStream oout = 
-	    new ObjectOutputStream(sbuf.getOutputStream());
-	ObjectInputStream oin = 
-	    new ObjectInputStream(sbuf.getInputStream());
-	
-	doReps(oout, oin, sbuf, trees, 1);	// warmup
+        int depth = Integer.parseInt(args[0]);
+        int nbatches = Integer.parseInt(args[1]);
+        int ncycles = Integer.parseInt(args[2]);
+        Node[] trees = genTrees(depth, ncycles);
+        StreamBuffer sbuf = new StreamBuffer();
+        ObjectOutputStream oout =
+            new ObjectOutputStream(sbuf.getOutputStream());
+        ObjectInputStream oin =
+            new ObjectInputStream(sbuf.getInputStream());
 
-	long start = System.currentTimeMillis();
-	doReps(oout, oin, sbuf, trees, nbatches);
+        doReps(oout, oin, sbuf, trees, 1);      // warmup
+
+        long start = System.currentTimeMillis();
+        doReps(oout, oin, sbuf, trees, nbatches);
         return System.currentTimeMillis() - start;
     }
 
@@ -100,33 +100,32 @@
      * Generate object trees.
      */
     Node[] genTrees(int depth, int ntrees) {
-	Node[] trees = new Node[ntrees];
-	for (int i = 0; i < ntrees; i++) {
-	    trees[i] = new Node(null, depth);
-	}
-	return trees;
+        Node[] trees = new Node[ntrees];
+        for (int i = 0; i < ntrees; i++) {
+            trees[i] = new Node(null, depth);
+        }
+        return trees;
     }
 
     /**
-     * Run benchmark for given number of batches, with each batch containing 
+     * Run benchmark for given number of batches, with each batch containing
      * the given number of cycles.
      */
     void doReps(ObjectOutputStream oout, ObjectInputStream oin,
-	        StreamBuffer sbuf, Node[] trees, int nbatches)
-	throws Exception
+                StreamBuffer sbuf, Node[] trees, int nbatches)
+        throws Exception
     {
-	int ncycles = trees.length;
-	for (int i = 0; i < nbatches; i++) {
-	    sbuf.reset();
-	    oout.reset();
-	    for (int j = 0; j < ncycles; j++) {
-		oout.writeObject(trees[j]);
-	    }
-	    oout.flush();
-	    for (int j = 0; j < ncycles; j++) {
-		oin.readObject();
-	    }
-	}
+        int ncycles = trees.length;
+        for (int i = 0; i < nbatches; i++) {
+            sbuf.reset();
+            oout.reset();
+            for (int j = 0; j < ncycles; j++) {
+                oout.writeObject(trees[j]);
+            }
+            oout.flush();
+            for (int j = 0; j < ncycles; j++) {
+                oin.readObject();
+            }
+        }
     }
 }
-