Conversation
|
Hi Luke. |
…very 5 msec The state machine thread woke every 5 msec, 200 times a second, even with nothing to do. A command is sent at once when it can be, by sendAecpCommand/sendAcmpCommand or when a response frees a slot, so the thread only has to time commands out, retry them, and send a queued command once the send interval allows. Advertising, discovery and remote entity timeouts are hundreds of milliseconds or more. The thread now waits until CommandStateMachine::getNextCheckTime(), the earliest inflight command timeout or time a queued command may be sent, but no longer than 250 msec, which is soon enough for advertising, discovery and remote entity timeouts, and for the watchdog. Whenever a command goes inflight, fails to be sent, or has to wait for the send interval, the command state machine tells the manager when it needs checking, and the manager wakes the thread if that is sooner than it waits for. So the thread never delays a command, a queued command is sent as soon as the send interval has elapsed rather than on the next 5 msec tick, and an idle thread wakes 4 times a second. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012i5Dd3gCyYqp4X7vxhSmxh
b6d53da to
40878d8
Compare
|
Thanks Christophe, that's a fair concern, and it led to a better approach. Looking more closely, the thread doesn't sit between a command and the network: So there's no need for a compile option. The thread now waits until |
|



The state machine thread wakes every 5 msec, 200 times a second, even when there's nothing to do. It doesn't stand between a command and the network:
sendAecpCommandandsendAcmpCommandsend a command at once when a slot is free, and a response releases the next queued command straight away. The thread only has to time commands out, retry them, and send a queued command once the send interval allows. Advertising, discovery and remote entity timeouts are all hundreds of milliseconds or more.CommandStateMachine::getNextCheckTime(), the earliest inflight command timeout or time a queued command may be sent, or now if errors are waiting to be reported. It waits no longer than 250 msec, which is soon enough for advertising, discovery and remote entity timeouts, and for the watchdog.Manager::scheduleStateMachinesCheck()with the time it needs checking. The manager wakes the thread if that is sooner than it is waiting for.stopStateMachineswakes the thread, so it stops at once.So the thread never delays a command, a queued command is sent as soon as the send interval has elapsed rather than on the next 5 msec tick, and an idle thread wakes 4 times a second instead of 200.
Testing: builds on
dev, and together with the thread name and watchdog changes in #203 and #204, the unit tests give the same results asdevwithout them: 289 of 292 pass.INTEGRATION_EndStation.DestroyWhileMessageInflight_pcapandINTEGRATION_ProtocolInterfacePCap_F.VuDelegatefail either way, as they need pcap access to a real interface. The run took 31.7 s, against 32.2 s fordev.🤖 Generated with Claude Code
https://claude.ai/code/session_012i5Dd3gCyYqp4X7vxhSmxh