Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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".

http://www.hants.lug.org.uk/wiki/HugoRandomBenchmark

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.