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> {
SignatureTemplate outgoingSignature) {
ExternalCallActionTemplate call = new ExternalCallActionTemplate(requiringRole, outgoingSignature);
if (isJMSComponent(componentName)) {
ForkActionTemplate fork = new ForkActionTemplate(false, 1);
fork.getForkedBehavior(0).add(call);
behavior.getComponentInternalBehavior().add(fork);
if (behavior.getComponentInternalBehavior().getActions().isEmpty()) {
ForkActionTemplate fork = new ForkActionTemplate(false, 1);
fork.getForkedBehavior(0).add(call);
behavior.getComponentInternalBehavior().add(fork);
}
} else {
LoopActionTemplate loop = new LoopActionTemplate();
loop.getLoopBehavior().add(call);
......
......@@ -34,9 +34,9 @@ public class MonitoringService implements Service<MonitoringService> {
private long timestamp;
private PrintWriter out;
public void prepare(PrintWriter out) {
public void prepare(PrintWriter out, long timestamp) {
this.out = out;
timestamp = System.currentTimeMillis();
this.timestamp = timestamp;
}
public void finish() {
......@@ -126,10 +126,13 @@ public class MonitoringService implements Service<MonitoringService> {
Printer printer = new Printer();
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))) {
printer.prepare(out);
printer.prepare(out, nextTime);
root.accept(printer);
} catch(Exception 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