Hi,
I'm running libplctag with cgo and it's using too much CPU. Or at least, it doesn't seem to be giving up the CPU to other processes. I wanted to increase the duration of some sleep calls in the code, but wasn't sure what exactly some of the parent functions did and if it would greatly affect execution.
Some more context: I'm basically opening a connection with an AB PLC once, and then reading a set of tags every second. Writes to tags happen sporadically and much less frequently. Ideally the connection is never closed and we keep reading tags at 1Hz.
The 2 main places where I wanted to lengthen the duration of sleep calls are:
1. THREAD_FUNC(session_handler) in ab/session.c
This seems to keep track of the session state, and the opening/closing of connections with the PLC. After I open the connection, it seems to stay in SESSION_IDLE state. If I'm not concerned about closing the connection, is it actually doing anything useful in the switch statement SESSION_IDLE case or can I increase the sleep_ms call to something like 100ms?
2. THREAD_FUNC(tag_tickler_func) in lib/lib.c
This implements auto-reads and auto-writes and callbacks, but I'm not using any of that functionality. It also calls the tickler func for all tags, but why does tag->vtable->tickler(tag) need to be called every ms in this THREAD_FUNC? It doesn't seem useful for my use case, which is calling Read() and then Status() and then GetValue() on each tag. If it's not useful in my specific scenario, then it also seems like I can increase this sleep_ms call to 100ms.
Thank you,
Alice