Closed ioannismavromatis closed 1 year ago
Hello, ioannismavromatis!
Thank you for bringing the error in our project to our attention. We appreciate your efforts in trying to help us to improve. We have implemented our own solution to solve the issue, but we want to acknowledge your contribution. Your input is valuable to us, and we hope you will continue to support our project in the future. Thank you again for your help. Check it out, now cpu_percent calculating works correctly!
Best wishes, eco2ai team
Hello,
When creating a CPU-based tracker on a Linux machine and trying to measure the power consumption for all CPU processed combined (cpu_processes="all"), I get the following ValueError:
This is due to how top prints on different terminals and terminal widths. In my setup top was printing one more empty space before PID.
I introduced a more generalised way of getting the results that matches top output using a substring instead of the entire line.
Try-except was also modified as top may produce results with processes marked as sleeping ('S' state). These processes don't consume CPU resources and, therefore, don't contribute to the overall power consumption.