Skip to content
Snippets Groups Projects
Commit 4597c448 authored by Simon Spinner's avatar Simon Spinner
Browse files

Log statistics a full minutes.

parent 4b0e55ab
No related branches found
No related tags found
No related merge requests found
...@@ -395,9 +395,11 @@ public class ModelExtractionService implements Service<ModelExtractionService> { ...@@ -395,9 +395,11 @@ public class ModelExtractionService implements Service<ModelExtractionService> {
SignatureTemplate outgoingSignature) { SignatureTemplate outgoingSignature) {
ExternalCallActionTemplate call = new ExternalCallActionTemplate(requiringRole, outgoingSignature); ExternalCallActionTemplate call = new ExternalCallActionTemplate(requiringRole, outgoingSignature);
if (isJMSComponent(componentName)) { if (isJMSComponent(componentName)) {
ForkActionTemplate fork = new ForkActionTemplate(false, 1); if (behavior.getComponentInternalBehavior().getActions().isEmpty()) {
fork.getForkedBehavior(0).add(call); ForkActionTemplate fork = new ForkActionTemplate(false, 1);
behavior.getComponentInternalBehavior().add(fork); fork.getForkedBehavior(0).add(call);
behavior.getComponentInternalBehavior().add(fork);
}
} else { } else {
LoopActionTemplate loop = new LoopActionTemplate(); LoopActionTemplate loop = new LoopActionTemplate();
loop.getLoopBehavior().add(call); loop.getLoopBehavior().add(call);
......
...@@ -34,9 +34,9 @@ public class MonitoringService implements Service<MonitoringService> { ...@@ -34,9 +34,9 @@ public class MonitoringService implements Service<MonitoringService> {
private long timestamp; private long timestamp;
private PrintWriter out; private PrintWriter out;
public void prepare(PrintWriter out) { public void prepare(PrintWriter out, long timestamp) {
this.out = out; this.out = out;
timestamp = System.currentTimeMillis(); this.timestamp = timestamp;
} }
public void finish() { public void finish() {
...@@ -126,10 +126,13 @@ public class MonitoringService implements Service<MonitoringService> { ...@@ -126,10 +126,13 @@ public class MonitoringService implements Service<MonitoringService> {
Printer printer = new Printer(); Printer printer = new Printer();
while(true) { while(true) {
Thread.sleep(WRITE_INTERVAL); long currentTime = System.currentTimeMillis();
// always do it at event intervals
long nextTime = (currentTime / WRITE_INTERVAL + 1) * WRITE_INTERVAL;
Thread.sleep(nextTime - currentTime);
try(final PrintWriter out = new PrintWriter(new FileWriter(new File("./operations.csv"), true))) { try(final PrintWriter out = new PrintWriter(new FileWriter(new File("./operations.csv"), true))) {
printer.prepare(out); printer.prepare(out, nextTime);
root.accept(printer); root.accept(printer);
} catch(Exception ex) { } catch(Exception ex) {
log.error("Error writing monitoring data.", ex); log.error("Error writing monitoring data.", ex);
......
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