Skip to content

Commit

Permalink
Update the SBK version print
Browse files Browse the repository at this point in the history
Signed-off-by: Keshava Munegowda <[email protected]>
  • Loading branch information
kmgowda committed May 2, 2020
1 parent 095c7a9 commit 10bba67
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 47 deletions.
5 changes: 3 additions & 2 deletions sbk-api/src/main/java/io/sbk/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
package io.sbk.api;

public class Config {
final public static String NAME = "sbk";
final public static String DESC = "Storage Benchmark Kit";

final public static int NS_PER_MICRO = 1000;
final public static int MICROS_PER_MS = 1000;
final public static int MS_PER_SEC = 1000;
Expand All @@ -23,8 +26,6 @@ public class Config {
final public static int DEFAULT_WINDOW_LATENCY = MS_PER_MIN;
final public static int DEFAULT_MAX_LATENCY = MS_PER_MIN * 15;

public String name;
public String description;
public String packageName;
public boolean fork;
public int reportingMS;
Expand Down
5 changes: 0 additions & 5 deletions sbk-api/src/main/java/io/sbk/api/Parameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ public interface Parameters {
*/
void printHelp();

/**
* Print the -version output.
*/
void printVersion();

/**
* Parse the command line arguments.
* @param args list of command line arguments.
Expand Down
16 changes: 1 addition & 15 deletions sbk-api/src/main/java/io/sbk/api/impl/SbkParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ final public class SbkParameters implements Parameters {
final private String benchmarkName;
final private String className;
final private String desc;
final private String version;
final private Options options;
final private HelpFormatter formatter;
final private CommandLineParser parser;
Expand Down Expand Up @@ -65,14 +64,13 @@ final public class SbkParameters implements Parameters {
private double throughput;
private CommandLine commandline;

public SbkParameters(String name, String desc, String version, String className, List<String> driversList, long startTime) {
public SbkParameters(String name, String desc, String className, List<String> driversList, long startTime) {
this.options = new Options();
this.formatter = new HelpFormatter();
this.parser = new DefaultParser();
this.benchmarkName = name;
this.desc = desc;
this.className = className;
this.version = version;
this.timeout = TIMEOUT;
this.driversList = driversList;
this.startTime = startTime;
Expand All @@ -94,7 +92,6 @@ public SbkParameters(String name, String desc, String version, String className,
"if 0 , writes 'records'\n" +
"if -1, get the maximum throughput");
options.addOption("help", false, "Help message");
options.addOption("version", false, "Version");
}

@Override
Expand All @@ -116,12 +113,6 @@ public void printHelp() {
}
}

@Override
public void printVersion() {
System.out.println(desc + ", " + benchmarkName +" version: " + version);
}


@Override
public boolean hasOption(String name) {
if (commandline != null) {
Expand Down Expand Up @@ -156,11 +147,6 @@ public void parseArgs(String[] args) throws ParseException, IllegalArgumentExcep
printHelp();
return;
}
if (commandline.hasOption("version")) {
printVersion();
return;
}

writersCount = Integer.parseInt(commandline.getOptionValue("writers", "0"));
readersCount = Integer.parseInt(commandline.getOptionValue("readers", "0"));

Expand Down
23 changes: 4 additions & 19 deletions sbk-api/src/main/java/io/sbk/main/SbkMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,7 @@ public static void main(final String[] args) {
System.exit(0);
}

try {
commandline = new DefaultParser().parse(new Options()
.addOption("version", false, "Version"),
args, true);
} catch (ParseException ex) {
ex.printStackTrace();
System.exit(0);
}
if (commandline.hasOption("version")) {
System.out.println(config.description + ", " + config.name + " version: " + version);
System.exit(0);
}

SbkLogger.log.info(config.NAME.toUpperCase() +" version: "+version);
try {
commandline = new DefaultParser().parse(new Options()
.addOption("class", true, "Benchmark Class"),
Expand All @@ -100,7 +88,7 @@ public static void main(final String[] args) {
driversList = getClassNames(config.packageName);
className = commandline.getOptionValue("class", null);
if (className == null) {
Parameters paramsHelp = new SbkParameters(config.name, config.description, version, "", driversList, startTime);
Parameters paramsHelp = new SbkParameters(config.NAME, config.DESC, "", driversList, startTime);
metric.addArgs(paramsHelp);
paramsHelp.printHelp();
System.exit(0);
Expand All @@ -122,7 +110,7 @@ public static void main(final String[] args) {
SbkLogger.log.error("Failure to create Benchmark object");
System.exit(0);
}
params = new SbkParameters(config.name, config.description, version, name, driversList, startTime);
params = new SbkParameters(config.NAME, config.DESC, name, driversList, startTime);
storage.addArgs(params);
metric.addArgs(params);
try {
Expand All @@ -132,9 +120,6 @@ public static void main(final String[] args) {
params.printHelp();
System.exit(0);
}
if (params.hasOption("version")) {
System.exit(0);
}
if (params.hasOption("help")) {
System.exit(0);
}
Expand All @@ -161,7 +146,7 @@ public static void main(final String[] args) {
metricsLogger = logger;
} else {
final CompositeMeterRegistry compositeLogger = Metrics.globalRegistry;
final String prefix = config.name.toUpperCase() + "_" + name + "_" + action + "_";
final String prefix = config.NAME.toUpperCase() + "_" + name + "_" + action + "_";
compositeLogger.add(new JmxMeterRegistry(JmxConfig.DEFAULT, Clock.SYSTEM));
compositeLogger.add(metricRegistry);
metricsLogger = new MetricsLogger(
Expand Down
6 changes: 0 additions & 6 deletions sbk-api/src/main/resources/sbk.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
#
# http://www.apache.org/licenses/LICENSE-2.0

# Name of the Framework
name=sbk

# Description
description=Storage Benchmark Kit

# Package Name to fetch the storage drivers
packageName=io.sbk

Expand Down

0 comments on commit 10bba67

Please sign in to comment.