| Execution time between one transition and the next [message #1872117] |
Tue, 22 October 2024 05:36  |
Eclipse User |
|
|
|
Hello,
On Windows Cygwin, we have observed a delay of 10 ms or more between the completion of one transition and the triggering of the next. This seems to be related to the implementation of the event-handling mechanism in the state machine by the code generator, which uses usleep(100).
Some models require a shorter wait time between two events. In certain cases--such as when multiple events occur in rapid succession or in the presence of concurrent states--this can lead to unstable or inconsistent triggers.
We've improved the system's stability by replacing usleep() with delay_ms() (although we haven't tested this with concurrent states).
Why was this function (usleep) added? What would be the impact if we decided to remove it?
Could you advise if there is a way (perhaps through configuration?) to reduce this delay while maintaining consistent results?
Best regards,
Antoine.
|
|
|
| Re: Execution time between one transition and the next [message #1872449 is a reply to message #1872117] |
Thu, 31 October 2024 11:31  |
Eclipse User |
|
|
|
Hi Antoine,
the behavior might be OS dependent, as a sleep of 100us should not cause delays in the order of 10ms.
A general reason for adding a sleep in an event loop is to avoid high-CPU load due to busy waiting. However, the EventQueue waits on a condition, i.e. it should not consume CPU while waiting for the arrival of an event. The sleep might still avoid high CPU load in the unusual case of waiting for a guard becoming true that is part of a transition without triggering event. I'll do some experiments and come back to you.
Ansgar
|
|
|
Powered by
FUDForum. Page generated in 0.03362 seconds