Replies: 2 comments 4 replies
-
Hi Mike, I have a couple of questions to get some more details:
Uncommenting the sleep likely won't have any impact because it's such a short duration to sleep. I am seeing the power monitor process have 100% utilization on my Pi 4, but overall, the Pi CPU is loaded just above 33%. The power monitor process is running as fast as possible, so it is expected to have 100% utilization. |
Beta Was this translation helpful? Give feedback.
-
It's a good qustion here, the solution of adding a sleep will only cause more problems based on the design today. In code like this running in a 'hot loop' to acquire data as fast as possible is comment for high performance systems, or for systems that need high precision to get sampled data properly. The question to ask is should the code be polling as fast as it is ? Or, is there a method we can use, or existing hardware (DMA) that will allow the CPU to only be used as new data arrives ? The heavy lifting ultimately should not be getting done by a CPU in the best case, but what else is on the board that can be used to manage this polling and shift to interrupts ? |
Beta Was this translation helpful? Give feedback.
-
I noticed my CPU usage is relatively high. This may not be an issue but I also saw a sleep(.1) commented out. Should I uncomment that to cause the raspberry pi to take a momentary break?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions