/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
*/
import bench.ConfigFormatException;
import bench.HtmlReporter;
import bench.TextReporter;
import bench.XmlReporter;
/**
* Object serialization benchmark mainline.
*/
public class Main {
static boolean verbose;
static boolean list;
static boolean exitOnTimer;
static int testDurationSeconds;
static volatile boolean exitRequested;
/**
* Print help message.
*/
static void usage() {
p.println("\nUsage: java -jar serialbench.jar [-options]");
p.println("\nwhere options are:");
p.println(" -h print this message");
p.println(" -v verbose mode");
p.println(" -l list configuration file");
p.println(" -t <num hours> repeat benchmarks for specified number of hours");
p.println(" -o <file> specify output file");
p.println(" -c <file> specify (non-default) configuration file");
p.println(" -html format output as html (default is text)");
p.println(" -xml format output as xml");
}
/**
* Print error message and exit.
*/
}
/**
* Mainline parses command line, then hands off to benchmark harness.
*/
setupStreams();
if (list) {
listConfig();
} else {
setupHarness();
if (exitOnTimer) {
while (true) {
if (exitRequested) {
}
}
} else {
}
}
}
/**
* Parse command-line arguments.
*/
usage();
verbose = true;
list = true;
die("Error: no timeout value specified");
try {
exitOnTimer = true;
} catch (Exception e) {
die("Error: unable to determine timeout value");
}
die("Error: no output file specified");
try {
} catch (IOException e) {
}
die("Error: no config file specified");
try {
} catch (IOException e) {
}
die("Error: conflicting formats");
die("Error: conflicting formats");
} else {
usage();
}
}
}
/**
* Set up configuration file and report streams, if not set already.
*/
static void setupStreams() {
die("Error: unable to find default config file");
}
/**
* Print contents of configuration file to selected output stream.
*/
static void listConfig() {
try {
byte[] buf = new byte[256];
int len;
} catch (IOException e) {
die("Error: failed to list config file");
}
}
/**
* Set up the timer to end the test.
*
* @param delay the amount of delay, in seconds, before requesting
* the process exit
*/
new TimerTask() {
public void run() {
exitRequested = true;
}
},
delay * 1000);
}
/**
* Set up benchmark harness.
*/
static void setupHarness() {
try {
} catch (ConfigFormatException e) {
} else {
die("Error: illegal config file syntax");
}
} catch (IOException e) {
die("Error: failed to read config file");
}
}
/**
* Setup benchmark reporter.
*/
static void setupReporter() {
switch (format) {
case TEXT:
break;
case HTML:
break;
case XML:
break;
default:
die("Error: unrecognized format type");
}
}
/**
* Run benchmarks.
*/
static void runBenchmarks() {
}
}