0

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?

1 Answer 1

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

You must log in to answer this question.

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