Skip to content

Commit

Permalink
Add information about number of completed steps in the EngineStatus c…
Browse files Browse the repository at this point in the history
…lass (#143)

* add nbLogicalStepCalled to EngineStatus
  as opposed to nbLogicalStepRun that counts only finished steps, this information counts the calls.
  This contributes to eclipse/gemoc-studio#123 by offering a way to control if the debug commands have been taken into account

* use NbLogicalStepCalled data in the Engine view
   the data about called step vs run step is used to display information about number of completed/not completed steps in the Engine view

Signed-off-by: Didier Vojtisek <didier.vojtisek@inria.fr>
  • Loading branch information
dvojtise committed Jan 10, 2020
1 parent 12e855b commit d4e46e9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ protected void doExecute() {
* step was done through a RecordingCommand, it can be given.
*/
protected final void beforeExecutionStep(Step<?> step, RecordingCommand rc) {

engineStatus.incrementNbLogicalStepCalled();
try {

currentSteps.push(step);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ public String getToolTipText(Object element) {
break;
}
result += "\n";
result += "Step " + engine.getEngineStatus().getNbLogicalStepRun();
long runSteps = engine.getEngineStatus().getNbLogicalStepRun();
long notCompletedSteps = engine.getEngineStatus().getNbLogicalStepCalled() - runSteps;
result += String.format("Steps (Completed[NotCompleted]): %d[%d]", runSteps, notCompletedSteps);
}
return result;
}
Expand All @@ -273,7 +275,9 @@ public String getText(Object element) {
String result = "";
if (element instanceof IExecutionEngine) {
IExecutionEngine<?> engine = (IExecutionEngine<?>) element;
result = String.format("%d", engine.getEngineStatus().getNbLogicalStepRun());
long runSteps = engine.getEngineStatus().getNbLogicalStepRun();
long notCompletedSteps = engine.getEngineStatus().getNbLogicalStepCalled() - runSteps;
result = String.format("%d[%d]", runSteps, notCompletedSteps);
}
return result;
}
Expand Down Expand Up @@ -379,7 +383,8 @@ public void engineStarted(IExecutionEngine<?> engine) {
}

@Override
public void aboutToExecuteStep(IExecutionEngine<?> executionEngine, Step<?> logicalStepToApply) {
public void aboutToExecuteStep(IExecutionEngine<?> engine, Step<?> logicalStepToApply) {
reselectEngine(engine);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
*/
public class EngineStatus {
long nbLogicalStepCalled = 0;
long nbLogicalStepRun = 0;

Step<?> chosenLogicalStep;
Expand Down Expand Up @@ -51,6 +52,27 @@ public void setNbLogicalStepRun(long nbLogicalStepRun) {
public void incrementNbLogicalStepRun() {
this.nbLogicalStepRun +=1;
}


/**
* Numbers of Logical step that have been called (may or may not have finished yet)
* @return number of steps that have been called
*/
public long getNbLogicalStepCalled() {
return nbLogicalStepCalled;
}
/**
* This method may be used to monitor engine progression
* @param nbLogicalStepCalled new value for nbLogicalStepCalled
*/
public void setNbLogicalStepCalled(long nbLogicalStepCalled) {
this.nbLogicalStepCalled = nbLogicalStepCalled;
}

/**
* An engine is responsible for incrementing this when a LogicalStep will be called
*/
public void incrementNbLogicalStepCalled() {
this.nbLogicalStepCalled +=1;
}

}

0 comments on commit d4e46e9

Please sign in to comment.