1 package org.sapia.ubik.rmi.examples.time; 2 3 import org.sapia.ubik.rmi.server.Hub; 4 import org.sapia.ubik.rmi.server.Log; 5 6 7 10 public class StressedTimeClient { 11 public static int COUNT = 100000; 12 13 public static void main(String [] args) { 14 Log.setInfo(); 15 16 try { 17 int i = 0; 18 TimeClient aClient = new TimeClient(false); 19 long aStart = System.currentTimeMillis(); 20 21 System.out.println( 22 "\n=============================================\n TEST EXECUTION STATISTICS\n---------------------------------------------"); 23 System.out.println("Starting test of " + COUNT + " iterations..."); 24 25 while (i++ < COUNT) { 26 aClient.execute(); 27 } 28 29 long delta = System.currentTimeMillis() - aStart; 30 31 System.out.println("Test Completed\n"); 33 System.out.println("Executed " + i + " calls in " + delta + " ms."); 34 System.out.println("Average of " + (i / (delta / 1000.0)) + 35 " tx per second"); 36 System.out.println("Average of " + ((delta) / (float) i) + 37 " millisecond per tx"); 38 System.out.println("=============================================\n"); 39 } catch (RuntimeException re) { 40 System.err.println( 41 "System error running the stressed time client, exiting..."); 42 re.printStackTrace(); 43 } finally { 44 try { 45 Hub.shutdown(30000); 46 } catch (InterruptedException e) { 47 e.printStackTrace(); 48 } 49 } 50 } 51 } 52 | Popular Tags |