Skip to content

Commit

Permalink
- added stopwatch
Browse files Browse the repository at this point in the history
- fixed SABINE installation validator
  • Loading branch information
jeichner committed Apr 28, 2013
1 parent d4b8606 commit f4515eb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Binary file added lib/commons-lang3-3.1.jar
Binary file not shown.
31 changes: 23 additions & 8 deletions src/main/SABINE_Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import java.util.Calendar;
import java.util.StringTokenizer;

import org.apache.commons.lang3.time.StopWatch;

import extension.PredictionEvaluator;

import model.ModelGenerator;
Expand All @@ -44,6 +46,9 @@ public class SABINE_Main {

boolean silent = false;

boolean stopTime = false;
StopWatch stopwatch = new StopWatch();

boolean dynamic_threshold = true;

public final static String version = "1.2";
Expand Down Expand Up @@ -257,18 +262,18 @@ public static void main(String[] args) {
newArgs[i-1] = args[i];
}
PredictionEvaluator.main(newArgs);

// run Installation Validation Mode
} else if (args.length == 1 && (args[0].equals("-check-install") || args[0].equals("--check-install"))) {
SABINE_Main.printCopyright();
SABINE_Validator validator = new SABINE_Validator();
validator.verifyInstallation();

// run Stand-Alone Mode
} else {

SABINE_Main.printCopyright();

if (args.length == 1 && (args[0].equals("-check-install") || args[0].equals("--check-install"))) {
SABINE_Validator validator = new SABINE_Validator();
validator.verifyInstallation();
return;
}

if (args.length == 0 || args.length == 1 && (args[0].equals("-help") || args[0].equals("--help"))) {
usage();
}
Expand All @@ -280,6 +285,7 @@ public static void main(String[] args) {
String infile = args[0];
String outfile = infile + ".out";
String verbose_option = "y";
String stopwatch_option = "n";
String base_dir = null;
String train_dir = FBPPredictor.public_trainingset;
String model_dir = FBPPredictor.defaultModelDir;
Expand All @@ -296,12 +302,13 @@ public static void main(String[] args) {
if(args[i].equals("-f")) { outfile = args[i+1]; continue; }
if(args[i].equals("-b")) { base_dir = args[i+1]; continue; }
if(args[i].equals("-t")) { train_dir = args[i+1]; continue; }
if(args[i].equals("-v")) { verbose_option = args[i+1]; continue; }
if(args[i].equals("-c")) { model_dir = args[i+1]; continue; }
if(args[i].equals("-v")) { verbose_option = args[i+1]; continue; }
if(args[i].equals("-w")) { stopwatch_option = args[i+1]; continue; }


if( !args[i].equals("-s") && !args[i].equals("-m") && !args[i].equals("-t") && !args[i].equals("-b") &&
!args[i].equals("-o") && !args[i].equals("-f") && !args[i].equals("-c") && !args[i].equals("-v")) {
!args[i].equals("-o") && !args[i].equals("-f") && !args[i].equals("-c") && !args[i].equals("-v") && !args[i].equals("-w")) {

System.out.println("\n Invalid argument: " + args[i]);
usage();
Expand All @@ -311,6 +318,10 @@ public static void main(String[] args) {
if (verbose_option.equals("n") || verbose_option.equals("no") || verbose_option.equals("h")) {
caller.silent = true;
}
if (stopwatch_option.equals("y") || stopwatch_option.equals("yes")) {
caller.stopTime = true;
caller.stopwatch.start();
}

if (! train_dir.endsWith("/")) {
train_dir += "/";
Expand All @@ -330,6 +341,10 @@ public static void main(String[] args) {

if (! caller.silent) System.out.println("\nOutput file: " + outfile + "\n");
}

if (caller.stopTime) {
System.out.println("Time elapsed: " + caller.stopwatch.toString());
}
}


Expand Down
2 changes: 1 addition & 1 deletion src/main/SABINE_Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void verifyInstallation() {
// run SABINE on generated input file
System.out.print("Checking installation of SABINE...");
predictor.silent = true;
predictor.predictFBP(validatorInputFile, validatorBaseDir, FBPPredictor.public_trainingset, null);
predictor.predictFBP(validatorInputFile, validatorBaseDir, FBPPredictor.public_trainingset, FBPPredictor.defaultModelDir);
System.out.println("done.\n");
// read output
boolean valid = compareOutfiles(validatorOutputFile, validatorBaseDir + "prediction.out");
Expand Down

0 comments on commit f4515eb

Please sign in to comment.