Column "duration_" in "act_hi_actinst"

Hi,
we are looking for column which describes execution time of element (scriptTask, sequenceFlow with condition). We have seen that in table act_hi_actinst there is column “duration_” but number of millis are calculated like startTime-endTime which is not right for us because element could be created at 11am and processed in 1 second at 11.30am(due to executor busy) so duration will be 30minutes and 1 second insted of 1 second…

So how can I find this kind of information and what is th purpose of column “duration_” calculated like this?

Why execution of sequence flow is calculated like this

 @Override
    public void recordSequenceFlowTaken(ExecutionEntity executionEntity) {
        ActivityInstanceEntity activityInstance = createActivityInstanceEntity(executionEntity);
        activityInstance.setDurationInMillis(0L);
        activityInstance.setEndTime(activityInstance.getStartTime());
        getHistoryManager().createHistoricActivityInstance(activityInstance);
    }

Hey @MirekSz,

The purpose of the duration is meant to show the amount of time it took for the activity to complete. i.e. from the moment it started until the moment it ended. If you async executor is busy then it does take 30 minutes and 1 second for the activity to be completed.

If you see for the sequence flow the start and end time are identical. A sequence flow is almost always done within one transaction, I assume that’s why it is calculated like in the snippet you provided.

Cheers,
Filip

Thanks you answer in this old question :slight_smile:

Don’t you think that calculating duration as difference of endTime-startTime could be done better. Lets “duration” express real time needed to execute scriptTask/serviceTask/sequenceFlow(sequence flow could have time consuming conditions) so script with sleep(500) should has duration about 500ms. Columns like startTime/endTime are still important because express time needed to executed by executor. But most important duration !=endTime-startTime.

With these data we could generate some statistcs/heatMap of most slowest elements/sequenceFlows.

Current with “duration” calculated in way endTime-startTime we don’t know if big duration is problem of element or busy executor…

Hey @MirekSz,

I see what you mean. For now the duration means endTime - startTime. I do understand your use case and I can see the benefit of it.

Do you have some ideas how this can be implemented? We are open in reviewing a PR that might bring this functionality.

Cheers,
Filip