Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some years ago a friend created a 'benchmark' (Note: Not a benchmark) by which wouldwhich we measure one raw aspect of computing power. Namely how fast (or indeed slowly) the computer could count to a large number. We called it "Hugo's Random Benchmark".

It consists of the following simple line which can be pasted into a shell to gauge computational power.

 time perl -e 'for($i=0;$i<1e8;$i++) { }'

It's very silly, largely pointless but was popular in our LUG for some time. One thing we never figured out was a simple way to do the same thing to test multi-core / multi-thread processors. How can this be achieved?

I'd like a simple easily copy/paste-able script which doesn't rely on installing many additional dependencies. We tend to run this on Linux/Unix systems so can assume some version of Perl (or Python) may be around, not necessarily additional perl modules / libraries.

Is there a simple way to carve this work up to an arbitrary number of cores and still get a reliably computed total runtime at the end?

share|improve this question
time (perl -e 'for($i=0;$i<1e8;$i++) { }' & perl -e 'for($i=0;$i<1e8;$i++) { }' & wait)

Add more perl commands for more than 2 cpus.

share|improve this answer

You must log in to answer this question.

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