Commit 30c83186 authored by Christian Meyer's avatar Christian Meyer
Browse files

DefaultSimulationLooper.java: status message is created by simulation state

build.gradle
    changed dependency for zmt-core to 0.17
parent 7beda9a4
......@@ -21,7 +21,7 @@ description = "Library for launching ZMT simulations"
dependencies {
compile group: 'args4j', name: 'args4j', version: '2.+'
compile 'de.zmt:zmt-core:0.11.0'
compile 'de.zmt:zmt-core:0.17.0'
// configuration needed when converted to project dependency
testCompile group: 'de.zmt', name: 'zmt-core', version: '0.+', classifier: 'test', configuration: 'test'
......
......@@ -4,7 +4,6 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.NumberFormat;
import java.time.Duration;
import java.util.Iterator;
import java.util.concurrent.ExecutorService;
......@@ -29,14 +28,6 @@ class DefaultSimulationLooper implements SimulationLooper {
private static final Logger logger = Logger.getLogger(DefaultSimulationLooper.class.getName());
private static final double NANO_FACTOR = 1e-09;
/** {@link NumberFormat} for simulation step rates. */
private static final NumberFormat RATE_FORMAT;
static {
RATE_FORMAT = NumberFormat.getInstance();
RATE_FORMAT.setMaximumFractionDigits(5);
RATE_FORMAT.setMinimumIntegerDigits(1);
}
@Override
public void loop(ZmtSimState simState, double simTime, int printStatusInterval) {
......@@ -119,10 +110,9 @@ class DefaultSimulationLooper implements SimulationLooper {
while (schedule.step(simState) && schedule.getTime() < simTime) {
long steps = schedule.getSteps();
if (printStatusInterval > 0 && steps > 0 && steps % printStatusInterval == 0) {
double rate = printStatusInterval / (NANO_FACTOR * (System.nanoTime() - systemTimeLastInterval));
logger.info("Job " + job + "/" + jobCount + ": " + "Steps: " + steps + " Time: "
+ schedule.getTimestamp("At Start", "Done") + " Rate: " + RATE_FORMAT.format(rate)
+ " steps/s");
double stepRatePerS = printStatusInterval
/ (NANO_FACTOR * (System.nanoTime() - systemTimeLastInterval));
logger.info("Job " + job + "/" + jobCount + ": " + simState.createStatusMessage(stepRatePerS));
systemTimeLastInterval = System.nanoTime();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment