Skip to content
Snippets Groups Projects
Commit 1a473fd8 authored by Terry D. Norbraten's avatar Terry D. Norbraten
Browse files

remove redundant casts, use System.err for error msgs

parent e1fe5827
No related branches found
No related tags found
No related merge requests found
......@@ -104,7 +104,7 @@ public class LiFiBenchmark
if(discards>0) {
System.out.println("Ignoring first "+discards+" repetitions");
if(discards>=reps) {
System.out.println("Error: discards >= repetitions");
System.err.println("Error: discards >= repetitions");
System.exit(1);
}
}
......@@ -130,7 +130,7 @@ public class LiFiBenchmark
showRep(startms, readAcc);
}
catch (IOException ex) {
System.out.println("Exception " + ex.getClass().getSimpleName() + " in networkRead(): " + ex.getMessage());
System.err.println("Exception " + ex.getClass().getSimpleName() + " in networkRead(): " + ex.getMessage());
System.exit(-1);
}
}
......@@ -153,7 +153,7 @@ public class LiFiBenchmark
}
}
catch (IOException ex) {
System.out.println("Exception waiting for connections: "+ex.getMessage());
System.err.println("Exception waiting for connections: "+ex.getMessage());
System.exit(-1);
}
}
......@@ -172,8 +172,8 @@ public class LiFiBenchmark
}
}
catch (IOException ex) {
System.out.println("Shutting down: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage());
System.out.println("Wrote "+wrote);
System.err.println("Shutting down: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage());
System.err.println("Wrote "+wrote);
}
}).start();
}
......@@ -196,10 +196,10 @@ public class LiFiBenchmark
return ret * 1000000000l;
default:
return ret;
}}
}
}
System.out.println("Error on command line. Don't understand "+s+" argument for byte count");
System.err.println("Error on command line. Don't understand "+s+" argument for byte count");
System.exit(1);
return -1; // not executed
}
......@@ -242,7 +242,6 @@ public class LiFiBenchmark
.longOpt("repetitions")
.desc("Number of transfers to perform")
.build());
opts.addOption(Option.builder("x")
.hasArg()
.required(false)
......@@ -254,7 +253,7 @@ public class LiFiBenchmark
return new DefaultParser().parse(opts, args);
}
catch (ParseException ex) {
System.out.println("Parsing failed: " + ex.getMessage());
System.err.println("Parsing failed: " + ex.getMessage());
System.exit(1);
return null;
}
......@@ -267,7 +266,7 @@ public class LiFiBenchmark
{
long endms = System.currentTimeMillis();
long span = endms - startms;
double spansecs = (double) span / 1000.d;
double spansecs = span / 1000.d;
System.out.println();
System.out.println("Read " + read + " bytes in " + span + " msec.");
......@@ -275,7 +274,7 @@ public class LiFiBenchmark
//System.out.format("Rate: %.2e bytes/sec%n",((double)readAcc/spansecs));
spanMsAccum += span;
bytesAccum+= read;
double bits = (double) read * 8.d;
double bits = read * 8.d;
//System.out.format("Rate: %.2e bits/sec%n",(bits/spansecs));
System.out.format("Rate: %.2e Mbit/s%n", ((bits / 1000000.d) / spansecs));
System.out.format("Rate: %.2f Gbit/s%n", ((bits / 1000000000.d) / spansecs));
......@@ -296,7 +295,7 @@ public class LiFiBenchmark
//System.out.format("Rate: %.2e bytes/msec%n", (bytesAvg / msAvg));
//System.out.format("Rate: %.2e bytes/sec%n",((double)readAcc/spansecs));
double bits = (double) bytesAvg * 8.d;
double bits = bytesAvg * 8.d;
//System.out.format("Rate: %.2e bits/sec%n",(bits/spansecs));
System.out.format("Rate: %.2e Mbit/s%n", ((bits / 1000000.d) / (secAvg)));
System.out.format("Rate: %.2f Gbit/s%n", ((bits / 1000000000.d) / (secAvg)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment