diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/README.txt ./README.txt --- ../SPECjbb2000.orig/README.txt 2006-12-18 14:26:29.000000000 +1100 +++ ./README.txt 2007-11-11 15:17:45.000000000 +1100 @@ -1,3 +1,43 @@ +----- Start notes for building and running pseudojbb2000 ----- +These are changes made to jbb to make it run a fixed workload. + +By default it will construct 8 warehouses and run 12500 transactions +each (100000 total). This is a reasonably solid workload and will +take 10-20sec to run a single iteration. It uses 8 software threads +(1 per warehouse). This is specified in SPECjbb-8x12500.props. You +can create your own props files if you wish. + +The changes are due to work by Darko Stefanovic, Martin Hirzel, +Robin Garner, and myself. + +There's no ant or make file, so to build, just do something like this: +===== +export JAVA_HOME= +cp -a SPECjbb2000 pjbb2000 # copy original source +chmod -R u+w pjbb2000 # fix permissions +cd pjbb2000 +patch -p0 < ../pjbb2000.patch +mkdir classes +cd src +$JAVA_HOME/bin/javac -d ../classes -classpath . `find . -name "*.java"` +cd ../classes +jar cf ../pseudojbb.jar * +cd .. +===== + +To run it, do something like this: + +$JAVA_HOME/bin/java -cp pseudojbb.jar spec.jbb.JBBmain -propfile SPECjbb-8x12500.props -n 2 + +You can specify a callback, in exactly the same way as the DaCapo suite: + +$JAVA_HOME/bin/java -cp pseudojbb.jar spec.jbb.JBBmain -propfile SPECjbb-8x12500.props -n 2 -c MMTkCallback + +There are stub and MMTk callbacks provided. + +--Steve Blackburn, Nov 2007 +----- End notes for building and running pseudojbb2000 ----- + SPECjbb2000 (Java Business Benchmark) Release 1.02 12/2001 diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/SPECjbb-8x12500.props ./SPECjbb-8x12500.props --- ../SPECjbb2000.orig/SPECjbb-8x12500.props 1970-01-01 10:00:00.000000000 +1000 +++ ./SPECjbb-8x12500.props 2007-11-10 15:12:54.000000000 +1100 @@ -0,0 +1,106 @@ +######################################################################### +# # +# Control parameters for SPECjbb benchmark # +# # +######################################################################### + +# +# This file has 2 sections; changable parameters and fixed parameters. +# The fixed parameters exist so that you may run tests any way you want, +# however in order to have a valid, reportable run of SPECjbb, you must +# reset them to their original values. +# + +######################################################################### +# # +# Changable input parameters # +# # +######################################################################### + +# Warehouse sequence may be controlled in either of two ways. The more +# usual method for specifying warehouse sequence is the triple +# input.starting_number_warehouses, input.increment_number_warehouses, +# and input.ending_number_warehouses, which causes the sequence of +# warehouses to progress from input.starting_number_warehouses to +# input.ending_number_warehouses, incrementing by +# input.increment_number_warehouses. +# The alternative method of specifying warehouse sequence is +# input.sequence_of_number_of_warehouses, which allows specification of +# an arbitrary list of positive integers in increasing order. + +# For a publishable result the warehouse sequence must begin at 1, +# increment by 1 and go to at least 8 warehouses + +input.starting_number_warehouses=1 +input.increment_number_warehouses=1 +input.ending_number_warehouses=8 +input.pseudojbb_transactions=12500 + +#input.sequence_of_number_of_warehouses=1 2 3 4 5 6 7 8 + +# +# 'forcegc' controls whether to garbage collect between each number of +# warehouses. +# + +input.forcegc=true + +# +# 'show_warehouse_detail' controls whether to print per-warehouse +# statistics in the raw results file. These statistics are not used +# in the final report but may be useful when analyzing a JVMs behavior. +# When running a large number of warehouses (i.e. on a system with a +# lot of CPUs), changing this to true will results in very large +# raw files. For submitions to SPEC, it is recommended that this +# attribute be set to false. +# + +input.show_warehouse_detail=false + +# +# 'include_file' is the name for the descriptive properties file. On +# systems where the file separator is \, use \\ as the file separator +# here. +# +# Examples: +# input.include_file=SPECjbb_config.props +# input.include_file=/path/to/SPECjbb_config.props +# input.include_file=c:\\path\\to\\SPECjbb_config.props +# + +input.include_file=SPECjbb_config.props + +# +# directory to store output files. On systems where the file separator +# is \, use \\ as the file separator here. +# +# Examples: +# input.include_file=results +# input.include_file=/path/to/results +# input.include_file=c:\\path\\to\\results +# +input.output_directory=results + +######################################################################### +# # +# Fixed input parameters # +# # +# YOUR RESULTS WILL BE INVALID IF YOU CHANGE THESE PARAMETERS # +# # +######################################################################### + +# DON'T CHANGE THIS PARAMETER, OR ELSE !!!! +input.suite=SPECjbb + +# +# If you need to collect stats or profiles, it may be useful to increase +# the 'measurement_seconds'. This will, however, invalidate your results +# + +# Amount of time to run each point prior to the measurement window + +input.ramp_up_seconds=0 + +# Time of measurement window + +#input.measurement_seconds=120 diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/src/MMTkCallback.java ./src/MMTkCallback.java --- ../SPECjbb2000.orig/src/MMTkCallback.java 1970-01-01 10:00:00.000000000 +1000 +++ ./src/MMTkCallback.java 2007-11-10 12:42:05.000000000 +1100 @@ -0,0 +1,63 @@ + + + +/* + * (C) Copyright Department of Computer Science, + * Australian National University. 2005 + */ + +import harness.Callback; + +import java.lang.reflect.Method; + +public class MMTkCallback extends Callback { + private final String callbackClass = "org.mmtk.plan.Plan"; + + private Method beginMethod, endMethod; + private boolean found = false; + + /** + * Locate the class where the harness resides in various versions + * of JikesRVM, and then retain Method references to the correct one. + */ + public MMTkCallback() { + try { + Class harnessClass = Class.forName(callbackClass); + beginMethod = harnessClass.getMethod("harnessBegin", (Class[])null); + endMethod = harnessClass.getMethod("harnessEnd", (Class[])null); + found = true; + } catch (ClassNotFoundException c) { + System.err.println("Could not locate "+callbackClass); + } catch (SecurityException e) { + System.err.println("harness method of "+callbackClass+" is not accessible"); + } catch (NoSuchMethodException e) { + System.err.println("harness method of "+callbackClass+" not found"); + } + if (!found) + System.err.println("WARNING: MMTk harness not found."); + } + + @Override + public void start() { + super.start(); + if (!found) return; + try { + beginMethod.invoke(null, (Object[])null); + } catch (Exception e) { + throw new RuntimeException("Error running MMTk harnessBegin",e); + } + } + + @Override + public void stop() { + if (found) { + try { + endMethod.invoke(null, (Object[])null); + } catch (Exception e) { + throw new RuntimeException("Error running MMTk harnessEnd",e); + } + } + super.stop(); + } +} + diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/src/harness/Callback.java ./src/harness/Callback.java --- ../SPECjbb2000.orig/src/harness/Callback.java 1970-01-01 10:00:00.000000000 +1000 +++ ./src/harness/Callback.java 2007-11-10 14:57:54.000000000 +1100 @@ -0,0 +1,42 @@ +package harness; + +public class Callback { + private static final long MS = 1000000; + long startTime = 0; + + public void startWarmup() { + salutation(false); + startTime = System.nanoTime(); + } + public void stopWarmup() { + long duration = System.nanoTime() - startTime; + message(true,true,duration/MS); + } + public void start() { + salutation(false); + startTime = System.nanoTime(); + } + public void stop() { + long duration = System.nanoTime() - startTime; + message(true,false,duration/MS); + } + + private void salutation(boolean warmup) { + System.err.print("===== pseudojbb 2000 starting "); + System.err.println((warmup ? "warmup " : "") + "====="); + System.err.flush(); + } + + private void message(boolean valid, boolean warmup, long elapsed) { + System.err.print("===== pseudojbb 2000"); + if (valid) { + System.err.print(warmup ? " completed warmup " : " PASSED "); + System.err.print("in " + elapsed + " msec "); + } else { + System.err.print(" FAILED " + (warmup ? "warmup " : "")); + } + System.err.println("====="); + System.err.flush(); + + } +} diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/src/spec/jbb/Company.java ./src/spec/jbb/Company.java --- ../SPECjbb2000.orig/src/spec/jbb/Company.java 2006-12-18 14:26:29.000000000 +1100 +++ ./src/spec/jbb/Company.java 2007-11-10 14:45:10.000000000 +1100 @@ -85,7 +85,8 @@ // timing variables: private long rampup_time; - private long measurement_time; +// private long measurement_time; + private long pseudojbb_transactions; private TimerData companyTimerData; private long elapsed_time; @@ -373,26 +374,26 @@ objectLock(SharedUpdate); companyTimerData.zeroTimerData(); rampup_time = 0; - measurement_time = 0; + pseudojbb_transactions = 0; TimerData warehouseTimerData = getTimerDataPtr(inWarehouseId); warehouseTimerData.setRampUpTime(rampup_time); - warehouseTimerData.setMeasurementTime(measurement_time); + warehouseTimerData.setPseudojbbTransactions(pseudojbb_transactions); objectUnLock(SharedUpdate); } public synchronized void start_automated(short inWarehouseId, int rampup_time, - int measurement_time) + int pseudojbb_transactions) { objectLock(SharedUpdate); companyTimerData.zeroTimerData(); this.rampup_time = rampup_time; - this.measurement_time = measurement_time; + this.pseudojbb_transactions = pseudojbb_transactions; TimerData warehouseTimerData = getTimerDataPtr(inWarehouseId); warehouseTimerData.zeroTimerData(); warehouseTimerData.setRampUpTime(rampup_time); - warehouseTimerData.setMeasurementTime(measurement_time); + warehouseTimerData.setPseudojbbTransactions(pseudojbb_transactions); objectUnLock(SharedUpdate); } @@ -645,17 +646,10 @@ JBButil.SecondsToSleep((int)rampup_time); mode = RECORDING; long start_time = System.currentTimeMillis(); - System.out.println("Timing Measurement began " + new Date().toString() + " for " + df.format(measurement_time/60.) + " minutes"); // display start time + System.out.println("Timing Measurement began " + new Date().toString() + " for " + pseudojbb_transactions + " transactions per thread"); // display start time // Wait while terminals do the recorded run - JBButil.SecondsToSleep((int)measurement_time); - - mode = RAMP_DOWN; - long end_time = System.currentTimeMillis(); - elapsed_time = end_time - start_time; - System.out.println("Timing Measurement ended " + new Date().toString()); // display stop time - System.out.println(""); - + System.out.println("pseudojbb waiting for threads"); synchronized(threadsDoneCountMonitor) { while (threadsDoneCount != MaxWarehouses*MaxTerminalsPerWarehouse) { try { @@ -666,6 +660,13 @@ } } + mode = RAMP_DOWN; + long end_time = System.currentTimeMillis(); + elapsed_time = end_time - start_time; + System.out.println("Timing Measurement ended " + new Date().toString()); // display stop time + System.out.println(""); + + System.out.println("pseudojbb ramped down"); mode = STOP; synchronized(stopThreadsCountMonitor) { while (stopThreadsCount != MaxWarehouses*MaxTerminalsPerWarehouse) { @@ -676,6 +677,7 @@ } } } + System.out.println("pseudojbb stopped"); // print results outPropFile.println(propPrefix + "warehouses=" + MaxWarehouses); diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/src/spec/jbb/JBBmain.java ./src/spec/jbb/JBBmain.java --- ../SPECjbb2000.orig/src/spec/jbb/JBBmain.java 2006-12-18 14:26:29.000000000 +1100 +++ ./src/spec/jbb/JBBmain.java 2007-11-10 14:36:14.000000000 +1100 @@ -24,6 +24,7 @@ import spec.jbb.validity.Check; import spec.jbb.validity.digest; +import harness.Callback; import spec.jbb.validity.digestExpected; import spec.jbb.infra.Base; import spec.jbb.infra.Factory.Factory; @@ -89,10 +90,10 @@ private int terminalsPerWarehouse; private int orderlinesPerOrder; private int rampupSeconds; - private int measurementSeconds; private int waitTimePercent; private boolean forceGC; private boolean showWarehouseDetail = false; + private int pseudojbbTransactions; private int startingNumberWarehouses; private int incrementNumberWarehouses; private int endingNumberWarehouses; @@ -153,6 +154,9 @@ { } + static private int harnessIteration = 1; + static private Callback harness = new Callback(); + public void run() { TransactionManager transMgr = null; @@ -233,7 +237,7 @@ short number_of_warehouses, short number_of_terminals, int rampup_time, - int measurement_time) + int pseudojbb_transactions) { short whID; @@ -252,7 +256,7 @@ try { for (whID = 1; whID <= number_of_warehouses; whID++) { - myCompany.start_automated(whID, rampup_time, measurement_time); + myCompany.start_automated(whID, rampup_time, pseudojbb_transactions); for (int terminal=1; terminal <= number_of_terminals; terminal++) { startJBBthread(whID, (byte)terminal); } @@ -387,14 +391,6 @@ retval = false; } - val = getRequiredProperty(prefix + "measurement_seconds"); - if (val != null) { - measurementSeconds = Integer.parseInt(val); - } - else { - retval = false; - } - val = getOptionalProperty(prefix + "wait_time_percent"); if (val != null) { @@ -483,6 +479,12 @@ } } + + val = getOptionalProperty(prefix + "pseudojbb_transactions"); + if (val != null) { + pseudojbbTransactions = Integer.parseInt(val); + } + val = getOptionalProperty(prefix + "starting_number_warehouses"); if (val != null) { startingNumberWarehouses = Integer.parseInt(val); @@ -563,7 +565,7 @@ // System.out.println("terminals_per_warehouse = " + terminalsPerWarehouse); // System.out.println("orderlines_per_order = " + orderlinesPerOrder); System.out.println(" ramp_up_seconds = " + rampupSeconds); - System.out.println(" measurement_seconds = " + measurementSeconds); + //System.out.println(" measurement_seconds = " + measurementSeconds); // System.out.println("wait_time_percent = " + waitTimePercent); if (checkThroughput) { // System.out.println("min_capacity_ratio = " + minBTPSRatio); @@ -571,6 +573,7 @@ System.out.println(" forcegc = " + forceGC); // System.out.println("steady_state = " + steadyStateFlag); // System.out.println("screen_write = " + screenWriteFlag); + System.out.println(" pseudojbb_transactions = " + pseudojbbTransactions); if (sequenceOfWarehouses == null) { System.out.println(" starting_number_warehouses = " + startingNumberWarehouses); System.out.println(" increment_number_warehouses = " + incrementNumberWarehouses); @@ -607,7 +610,7 @@ "terminals_per_warehouse", "orderlines_per_order", "ramp_up_seconds", - "measurement_seconds", + "pseudojbb_transactions", "wait_time_percent", "forcegc", "screen_write", @@ -731,7 +734,7 @@ cur_warehouses = num_wh; DoARun( myCompany, (short)myCompany.getMaxWarehouses(), myCompany.getMaxTerminalsPerWarehouse(), - rampupSeconds, measurementSeconds); + rampupSeconds, pseudojbbTransactions); if (checkThroughput) { TimerData companyTimerDataPtr = myCompany.getTimerDataPtr((short)0); double result = companyTimerDataPtr.getBTPS(); @@ -753,7 +756,7 @@ cur_warehouses = num_wh; DoARun( myCompany, (short)myCompany.getMaxWarehouses(), myCompany.getMaxTerminalsPerWarehouse(), - rampupSeconds, measurementSeconds); + rampupSeconds, pseudojbbTransactions); if (checkThroughput) { TimerData companyTimerDataPtr = myCompany.getTimerDataPtr((short)0); double result = companyTimerDataPtr.getBTPS(); @@ -878,31 +881,7 @@ finder = Finder.getFinder(); main = new JBBmain(); - if (args.length == 0) { - main.propertiesFileName = "SPECjbb.props"; - } - else if (args[0].equals("-propfile")) { - if (args.length == 2) { - main.propertiesFileName = args[1]; - } - else { - if (args.length == 1) { - System.out.println("Missing properties file name"); - System.out.println(" Parameters: -propfile "); - return; - } - else { - System.out.println("Too many parameters"); - System.out.println(" Parameters: -propfile "); - return; - } - } - } - else { - System.out.println("Unrecognized command line parameter: " + args[0]); - System.out.println(" Parameters: -propfile "); - return; - } + main.propertiesFileName = commandLineParser(args); System.out.println( "" ); System.out.println( "Loading properties from " + main.propertiesFileName); @@ -1016,7 +995,14 @@ Finder.setFinder(finder); } + for (int i=1; i < harnessIteration; i++) { + harness.startWarmup(); main.DOIT(companyContainer); + harness.stopWarmup(); + } + harness.start(); + main.DOIT(companyContainer); + harness.stop(); if (printPropertiesAndArgs) { // Puts sorted System Properties into Raw file @@ -1033,95 +1019,52 @@ } outRawFile.println(); } + System.exit(0); + } - // amt: call Reporter - System.out.println("\n\nCalling Reporter"); - - boolean opte = true; - boolean opth = false; - String optr = outRawFile_name; - String optl = sequenceNumber; // seq # - // 06/28/00 WRR -- v 1.01 - // optj is gone. opts is new. - boolean opts = false; - String optn = null; - String opto = output_directory + File.separator + outRawPrefix + sequenceNumber + ".html"; - String file_Ascii = output_directory + File.separator + outRawPrefix + sequenceNumber + ".asc"; - String optc = null; - String optS = null; - boolean optv = false; - spec.reporter.Report r; - try { - // 06/28/00 WRR -- v 1.01 - // opts is new. - AsciiReport ar = new spec.reporter.AsciiReport(optn, optr, opts); - ar.print ( file_Ascii); + public static String commandLineParser(String args[]) { + String propsFileName = "SPECjbb.props"; + for (int i=0; i < args.length; i++) { + if (args[i].charAt(0) == '-') { + if (args[i].equals("-propfile")) { + i++; + if (i == args.length) { + System.out.println("Missing properties file name"); + return null; } - catch (Exception e) { } - - try { - // 06/28/00 WRR -- v 1.01 - // optj is gone. opts is new. - r = new spec.reporter.Report(opte, opts, optn, optr, - optv, optc, optl, opth, output_directory); - } - catch (Exception e) { - opth = true; - System.out.println("Producing html chart in report instead of JPEG; see Users' Guide"); - // 06/28/00 WRR -- v 1.01 - // optj is gone. opts is new. - r = new spec.reporter.Report(opte, opts, optn, optr, - optv, optc, optl, opth, output_directory); - } - catch (java.lang.InternalError e) { - opth = true; - System.out.println("Producing html chart in report instead of JPEG; see Users' Guide"); - // 06/28/00 WRR -- v 1.01 - // optj is gone. opts is new. - r = new spec.reporter.Report(opte, opts, optn, optr, - optv, optc, optl, opth, output_directory); - } - catch (java.lang.UnsatisfiedLinkError e) { - opth = true; - System.out.println("Producing html chart in report instead of JPEG; see Users' Guide"); - // 06/28/00 WRR -- v 1.01 - // optj is gone. opts is new. - r = new spec.reporter.Report(opte, opts, optn, optr, - optv, optc, optl, opth, output_directory); - } - catch (java.lang.Error e) { - opth = true; - System.out.println("Producing html chart in report instead of JPEG; see Users' Guide"); - // 06/28/00 WRR -- v 1.01 - // optj is gone. opts is new. - r = new spec.reporter.Report(opte, opts, optn, optr, - optv, optc, optl, opth, output_directory); + propsFileName = args[i]; + } else if (args[i].equals("-n")) { + i++; + if (i == args.length) { + System.out.println("Missing number of iterations after \"-n\" flag"); + return null; + } + JBBmain.harnessIteration = Integer.valueOf(args[i]); + } else if (args[i].equals("-c")) { + i++; + if (i == args.length) { + System.out.println("Missing callback class name after \"-c\" flag"); + return null; } - r.print(opto); - try { - BufferedReader AscBr = new BufferedReader(new FileReader(file_Ascii)); - String s; - while ( (s = AscBr.readLine() ) != null) { - System.out.println(s); + Class harnessClass = (Class)Class.forName(args[i]); + JBBmain.harness = harnessClass.newInstance(); + } catch (Exception e) { + throw new RuntimeException("Exception thrown while creating harness class "+args[i],e); } + } else { + System.out.println("Unrecognized parameter "+args[i]); + return null; } - catch (IOException e) { - System.out.println("Error opening ASCII output file"); + } else { + System.out.println("Unrecognized parameter "+args[i]); + return null; } - - System.out.println("Output files: " + file_Ascii + ", " + outRawFile_name + ", " + opto); - System.out.println(); - System.out.println(); - System.out.println("Reporter messages:"); - System.out.println(r.messages()); - SaveOutput.stop(); - // CJB 2001/10/23: Compress the raw results file. - // JBButil.compressFile(outRawFile_name); - - System.exit(0); } + return propsFileName; + } + private synchronized static int getNumericInput() { @@ -1196,9 +1139,6 @@ compliant = checkCompliance(rampupSeconds, COMPLIANT_RATE_rampupSeconds, "ramp_up_seconds") && compliant; - compliant = checkCompliance(measurementSeconds, - COMPLIANT_RATE_measurementSeconds, - "measurement_seconds") && compliant; compliant = checkCompliance(waitTimePercent, COMPLIANT_RATE_waitTimePercent, "wait_time_percent") && compliant; diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/src/spec/jbb/TimerData.java ./src/spec/jbb/TimerData.java --- ../SPECjbb2000.orig/src/spec/jbb/TimerData.java 2006-12-18 14:26:29.000000000 +1100 +++ ./src/spec/jbb/TimerData.java 2007-11-10 13:10:40.000000000 +1100 @@ -147,7 +147,7 @@ private long rampup_time; // time to run before measuring - private long measurement_time; // time to run while measuring + private long pseudojbb_transactions; // time to run while measuring private double tpmc; // transactions per minute final result for this object private double btps; // "Business Transaction per Second" final result for this object @@ -185,7 +185,7 @@ rampup_time = 0; - measurement_time = 0; + pseudojbb_transactions = 0; useWaits = false; tpmc = 0; @@ -336,11 +336,11 @@ } public synchronized void - setMeasurementTime(long in_measurement_time) + setPseudojbbTransactions(long in_pseudojbb_transactions) { objectLock(SharedUpdate); // convert seconds to milliseconds - measurement_time = in_measurement_time; + pseudojbb_transactions = in_pseudojbb_transactions; objectUnLock(SharedUpdate); } @@ -354,10 +354,10 @@ } public synchronized long - getMeasurementTime() + getPseudojbbTransactions() { objectLock(SharedRead); - long temp = measurement_time; + long temp = pseudojbb_transactions; objectUnLock(SharedRead); return temp; } diff -uwNr --exclude=bin --exclude=.project --exclude=.classpath ../SPECjbb2000.orig/src/spec/jbb/TransactionManager.java ./src/spec/jbb/TransactionManager.java --- ../SPECjbb2000.orig/src/spec/jbb/TransactionManager.java 2006-12-18 14:26:29.000000000 +1100 +++ ./src/spec/jbb/TransactionManager.java 2007-11-10 14:54:02.000000000 +1100 @@ -119,8 +119,7 @@ // JBButil.random_init(); // find TimerData object for this warehouse TimerData warehouseTimerDataPtr = company.getTimerDataPtr(warehouseId); - long rampup_time = warehouseTimerDataPtr.getRampUpTime(); - long measurement_time = warehouseTimerDataPtr.getMeasurementTime(); + long pseudojbb_transactions = warehouseTimerDataPtr.getPseudojbbTransactions(); // create object to store timer data for this process TimerData myTimerData = TimerData.createTimerData(this, (AccessMode)null); @@ -154,7 +153,7 @@ } - if ((rampup_time > 0) || (measurement_time > 0)) + if ((pseudojbb_transactions > 0)) { timed = true; } @@ -190,8 +189,7 @@ } } - while (company.mode != Company.STOP) - { + for (int iTrans=0; iTrans