Hello @ned-kelly
This is regarding speed performance improvement.
I just put some additional lprintf comments to main() function in order to identify speed bottleneck and it seems to me that main huge delay is introduced by shell command invoke itself. For example command:
-
docker exec -it voltronic-mqtt bash -c ‘/opt/inverter-cli/bin/inverter_poller -1’
will introduce 5s till I could see first lprintf message which is placed at the beginning of main() function - right after the curly bracket. All next code output is then provided within 2 seconds including qpigs request to inverter -
docker exec -it voltronic-mqtt bash -c ‘/opt/inverter-cli/bin/inverter_poller -2’
This command will invoke inverter_poller just once and then repeatedly (inside the while()) call qpigs to inverter. And this is pretty fast! ~ 2s.
Conclusion/question:
- I have an idea to implement mqtt commands directly in c++ sources and avoid any other shell scripts except entrypoint.sh of course
- is there some reason why this solution is based on combination of C++ & shell please? (I hope that reason is that c++ sources were just more-less reused from manio’s skymax)
I’m now going to study how to compile some linux mqtt c++ library and how to compile, include to docker and use. I have no idea/experiences so far if there is some showstopper hence I’m asking here.
additional notes:
- I’m using Raspberry pi1 model B+
- in the test above I’m asking inverter just qpigs
Thanks for any comment / advice.