Sometime we come across situation where we need to throttle or degrade CPU performance.
Suppose there is a situation you deploy your application in low performance system but development is done on high performance system.
To simulate lower performance system you need to do CPU throttling.
Here I am discussing how we can do this using Windows 11 OS. Similar feature should be available in Linux or other operating systems as well.
Assuming we are using Windows 11 OS as super user, open Performance Monitor application tool. In Windows you can open this by invoking perfmon.exe /res from search or run option.
Using this tool open CPU performance monitor to monitor current CPU(s). In the GUI there are two panes. From left pane, tree view choose Performance -> Monitoring Tools -> Performance Monitor view.
In the right pane, you should see two sub-view one graph view on the top and one selected counters view on the bottom. Right click on the the bottom view and choose Add Counters.
In the pop up window choose Computer and Counters (Processor Information in our example) and target processor instances (you may choose All instances of processor or a specific instance). Right side of the pop up Window the selected counter are shown. An illustration is shown below.
Now press OK to complete the Counter and Computer selection.
In the Performance Monitor view now you should see the values of the selected counters and the current counter values in Time (X-axis) vs Counter value (Y-axis) graph. There are quite a few Processor Performance related counter. We can choose only Processor Frequency of one of CPU instance to have a simple and easy to understand graph view. An illustration added.
Now we will perform CPU throttling using power option and see the impact via the graph view.
Open Control Panel > Hardware and Sound > Power Options. Click on the advanced power settings.
An illustration added.
Now in the advanced power settings window, choose processor power management. Choose maximum and minimum power state. Note down your current settings before modifying the values. An illustration added.
Now change maximum processor state and apply and check in the Performance Monitor Window, the CPU the %Maximum of Frequency values getting reflected.
You can write simple script to do some computation and run the application with before and and after changing maximum processor state and to see the impact.
When done, revert your settings using noted down values.
Comments