Hackster.io Cpu stress o meter


issue in the program saying that there is no module named psutil

You can install and import the library. On the command line, enter:

pip3 install psutil

Now, try the import.

tysm…Now how can I check whether its working or not ?..I mean how can I put my cpu to overload/stress.

@yogeshdt085 You can try simulating a load by either changing the value of the cpu_usage manually by setting the variable above the threshold.

    cpu_usage = psutil.cpu_percent(interval=interval)
    print ("Actual CPU Usage is", cpu_usage)
    cpu_usage = 1 # This will manually set the value of the CPU usage higher than the red_threshold
    print ("Setting CPU Usage to", cpu_usage)

The above is a safe option to test out if the script without having to actually overload the CPU.

There are also various tools which you can use to actually overload your CPU. However, they carry an inherent risk. You can visit the link below and try out the software mentioned AT YOUR OWN RISK.


any solution??

Hi @kahkeshan2299,

Type the below commands to install and upgrade psutil library.

sudo pip3 install psutil
sudo pip3 install --upgrade psutil

Do let me know in case you need any other information.

1 Like