How can I simulate having a slow CPU?
I am almost done coding my webapp-game. It runs on all modern browsers. However, I want to establish some minimum requirements for it.
Thus, I need a slow Mac. However, I don't have access to a slow Mac that has a modern browser (IE 9+, Safari 5+, Opera 11+, Chrome, Firefox 4+).
Using the tool mentioned in this question, I can simulate a slow Internet connection. I can use up plenty of memory easily. However, I have no clue how to simulate a slow CPU without resorting to underclocking.
Is there any way I can make my Mac's CPU slower temporarily without underclocking?
One solution is to use virtualization to have another instance of Mac OS X running on your computer. Many virtualization applications (such as Parallels Desktop) let you decide how much resources an instance can have (e.g. memory or cpu). Lion increased its support of virtualizing Mac OS X.
If you do decide to go with Parallels, there's a useful how to article describing how to set up an instance of another Mac OS X Lion.
A good way is to use the command-line utility cputhrottle
, which allows you to set a cap to how much CPU a given process is allowed to use.
Install it with (for instance) brew: brew install cputhrottle
Then choose how much processor percentage the process for your browser (and/or your browser tab content process) can use: cputhrottle <PID> <PERCENTAGE>
.
You can find the process ID using the Activity Monitor app.
To terminate cputhrottle (which actively throttles the process for as long as it's running), press Control-C.
You could always install OS X in a virtual machine and set the virtual machine to have a slower processor, perhaps.
Run a few instances of yes > /dev/null &
. Each instance will peg a core to 100%, so run one for each core. You could also try re-nice
ing the yes processes to a higher priority or lowering the priority the browser.