Open Jayashree-ux opened 1 month ago
The issue here is that the utility runs without any delay, causing high CPU usage. We'll fix this by implementing a more efficient polling system with a sleep interval. Added Sleep Interval: In the run method, we introduced a time.sleep(interval) to reduce CPU load by avoiding constant polling. Interval Option: The user can specify the time interval (in seconds) between each monitoring cycle via the command line, reducing the load on the CPU.
Inefficient Polling: The current version continuously queries system data without any delays, causing the CPU to remain busy even when no new information needs to be updated.
Lack of Sleep Interval: There is no delay or "sleep" mechanism between polling cycles, making the program unnecessarily consume CPU resources even during idle periods.
Unoptimized System Calls: System calls for process details are repeated in rapid succession, leading to bottlenecks and higher system load, especially when the user is tracking numerous processes.