5

How can I put my CPU under very high pressure for a long period of time? Are there programs for that that I can keep running ?

0

5 Answers 5

4

At the command line, run this command:

cat < /dev/urandom > /dev/null

(Open up a terminal window and type that into the window.)

This should keep your CPU loaded nicely for as long as you allow the command to run.

3
  • 1
    This will only use one core/thread so not take up 100% CPU
    – mmmmmm
    Jan 20, 2013 at 10:27
  • 2
    @Mark so have multiple instances running. Easy solution.
    – JoshRagem
    Jan 20, 2013 at 12:15
  • Multiple instances (as in, one per core), wouldn't exactly mean they get distributed to an individual core by the OS.
    – jmlumpkin
    Jan 20, 2013 at 20:57
3

Look at some distributed computing like Boinc. This runs compute intensive programs where tasks are taken and run across many machines thus allowing projects access to free computing power. In your case as the programs take up much compute power they will use the CPU heavily. Boinc runs multiple processes on your computer so will se all cores of your CPU.

2

Do the following once for each CPU core in your Mac, open Terminal.app and enter the command:

yes

The yes command will print the letter y to standard output in an infinite loop.

4
  • The OS may not assign this once to each core, and even so, just outputting yes to the terminal may push a cpu at 100%.
    – jmlumpkin
    Jan 20, 2013 at 20:58
  • 5
    To run this once for each core: ncpu=$(sysctl hw.ncpu | awk '{ print $2; }'); for ((i=1;i<=ncpu;i++)); do yes >/dev/null & done Jan 20, 2013 at 21:37
  • @jmlumpkin It works. At least on current Apple platforms.
    – bot47
    Jan 21, 2013 at 17:55
  • I think I read your answer a bit differently. What I was trying to say is that Terminal is going to distribute for this, and saying 'do this once for each core' isn't going to peg a quad core i5 at 400% utilization. I read your answer much more as 'doing this in a new terminal window will assign it to another core'.
    – jmlumpkin
    Jan 21, 2013 at 18:08
0

Just create a small program that loops infinitely, something like:

#include <stdio.h>
int main()
{
    int i=0;
    for(;;)
    {
         i++;
         i--;
    }
}
1
  • 4
    This only runs on one thread so will not run at 100% of your CPU as all Macs are multi core. Also a good optimiser will probablget rid of that loop
    – mmmmmm
    Jan 20, 2013 at 10:29
0

Several database systems are multicore optimized. You could install something like mysql and setup a basic data set, then run some of the benchmarking tools against it. If tuned correctly, many DB systems are most efficient at high CPU load (because if it was not, you would be wasting resources).

Or, you could just wash a flash video in Safari.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .