Being fairly new to linux and curious about the processing ability of the Pi, I was searching a script I could use to test its ability and found this:
http://tuxshell.blogspot.co.uk/2009/08/ ... hmark.html
So I use the script "time echo "scale=5000; a(1)*4" | bc -l" but encontered a problem about "bc" not being a command. What is bc? am I correct in thinking its a shell calculator? how would I go about getting this to work?
- stuartheath
- Posts: 23
- Joined: Mon Jun 18, 2012 9:42 pm
Re: Benchmarking the Pi in the shell
"bc" does not but "bg" tells a command to run in the background (thinks typo in the original)
Just an idea

Just an idea

Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek 
If you find a solution please post it in the wiki the forum dies too quick

If you find a solution please post it in the wiki the forum dies too quick
- jackokring
- Posts: 818
- Joined: Tue Jul 31, 2012 8:27 am
- Location: London, UK
- Contact: ICQ
Re: Benchmarking the Pi in the shell
Decimal Calculator. It works like slow interpreted C. Combined with dc and expr, any shell script can do maths. Not super fast maths, but maths. Hence down to benchmarketing. Maybe check the internet to see which package should be sudo apt-got.
If your getting into maths programming, the maybe Octave (a programming language) is more useful to benchmark. I'm not sure if full general CAS is easily available on the Pi, but I may be wrong. Anyhow, much of the newer stuff, to do with polylog and differential equation solving algebraically is bleeding edge. Google "list of finite simple groups" for some background on the "factors" of any finite solution with pattern.
If your getting into maths programming, the maybe Octave (a programming language) is more useful to benchmark. I'm not sure if full general CAS is easily available on the Pi, but I may be wrong. Anyhow, much of the newer stuff, to do with polylog and differential equation solving algebraically is bleeding edge. Google "list of finite simple groups" for some background on the "factors" of any finite solution with pattern.
Pi[NFA]=B256R0USB CL4SD8GB Raspbian Stock.
Pi[Work]=A+256 CL4SD8GB Raspbian Stock.
My favourite constant 1.65056745028
Pi[Work]=A+256 CL4SD8GB Raspbian Stock.
My favourite constant 1.65056745028
Re: Benchmarking the Pi in the shell
bc is quite a powerful command line calculator :
http://linuxjournal.com/article/2544
http://linuxjournal.com/article/2544
Android app - Raspi Card Imager - download and image SD cards - No PC required !
- stuartheath
- Posts: 23
- Joined: Mon Jun 18, 2012 9:42 pm
Re: Benchmarking the Pi in the shell
Thanks guys got it working by:
"sudo apt-get install bc"
Used the script:
"time echo "scale=2000; a(1)*4" | bc -l" and got
real 0m25.512s
user 0m25.450s
sys 0m0.010s
This was done on a default 700mhz Pi, if someone would like to test the same script on a 800mhz overclocked Pi and post the results that would be great to see. I may use a scale of 10000 and leave it over night and see the results I get, plus it'll be a great way to test the stability of the Pi.
"sudo apt-get install bc"
Used the script:
"time echo "scale=2000; a(1)*4" | bc -l" and got
real 0m25.512s
user 0m25.450s
sys 0m0.010s
This was done on a default 700mhz Pi, if someone would like to test the same script on a 800mhz overclocked Pi and post the results that would be great to see. I may use a scale of 10000 and leave it over night and see the results I get, plus it'll be a great way to test the stability of the Pi.
Re: Benchmarking the Pi in the shell
You probably have the old kernal 3.1.9? (uname -a tells it)
Here are my results with that kernel:
arm_freq=800
sdram_freq=500
#BogoMIPS : 795.44
real 0m22.501s
user 0m22.140s
sys 0m0.020s
Here are my results with that kernel:
arm_freq=800
sdram_freq=500
#BogoMIPS : 795.44
real 0m22.501s
user 0m22.140s
sys 0m0.020s
- stuartheath
- Posts: 23
- Joined: Mon Jun 18, 2012 9:42 pm
Re: Benchmarking the Pi in the shell
What suggests im using the old kernal? But yes, i'm using 3.1.9+
- alexeames
- Forum Moderator
- Posts: 2874
- Joined: Sat Mar 03, 2012 11:57 am
- Location: UK
- Contact: Website
Re: Benchmarking the Pi in the shell
This looks fun so I thought I'd play too.
I tried your amended (2000) one after I noticed the 5000 version was taking rather longer than yours.
Mine's clocked at
BogoMIPS : 898.66
arm_freq=900
sdram_freq=450
gpu_freq=320
3 sets of results...
real 19.108s, 19.595s, 19.296s
user 18.980s, 19.470s, 19.180s
sys 0.030s, 0.020s, 0.030s
The ARM processor is a mere wart on the side of the GPU though.

I tried your amended (2000) one after I noticed the 5000 version was taking rather longer than yours.

Mine's clocked at
BogoMIPS : 898.66
arm_freq=900
sdram_freq=450
gpu_freq=320
3 sets of results...
real 19.108s, 19.595s, 19.296s
user 18.980s, 19.470s, 19.180s
sys 0.030s, 0.020s, 0.030s
The ARM processor is a mere wart on the side of the GPU though.

Alex Eames RasPi.TV, RasP.iO
- stuartheath
- Posts: 23
- Joined: Mon Jun 18, 2012 9:42 pm
Re: Benchmarking the Pi in the shell
Is there a way of benchmarking the gpu?
Re: Benchmarking the Pi in the shell
http://en.wikipedia.org/wiki/John_Machin
real 0m7.592s
Code: Select all
echo "scale=2011; 16*a(1/5)-4*a(1/239)" |(time bc -l)
Re: Benchmarking the Pi in the shell
The new kernel is about 10% faster, so I based my guess to your perf numbers. 
My results using the new kernel 3.2.27 without overclock(but with the usb patch: dwc_otg.fiq_fix_enable=1):
#BogoMIPS : 697.95
real 0m23.727s
user 0m23.660s
sys 0m0.010s
And with overclock:
arm_freq=900
sdram_freq=500
gpu_freq=400
#BogoMIPS : 898.66
real 0m18.213s
user 0m18.160s
sys 0m0.010s

My results using the new kernel 3.2.27 without overclock(but with the usb patch: dwc_otg.fiq_fix_enable=1):
#BogoMIPS : 697.95
real 0m23.727s
user 0m23.660s
sys 0m0.010s
And with overclock:
arm_freq=900
sdram_freq=500
gpu_freq=400
#BogoMIPS : 898.66
real 0m18.213s
user 0m18.160s
sys 0m0.010s
- alexeames
- Forum Moderator
- Posts: 2874
- Joined: Sat Mar 03, 2012 11:57 am
- Location: UK
- Contact: Website
Re: Benchmarking the Pi in the shell
That's cheatingjojopi wrote:http://en.wikipedia.org/wiki/John_Machinreal 0m7.592sCode: Select all
echo "scale=2011; 16*a(1/5)-4*a(1/239)" |(time bc -l)


Alex Eames RasPi.TV, RasP.iO
- stuartheath
- Posts: 23
- Joined: Mon Jun 18, 2012 9:42 pm
Re: Benchmarking the Pi in the shell
i dont suppose someone could break that script down to me so I can actually make sense of what its actually doing? 

Re: Benchmarking the Pi in the shell
The time command measures how long it takes to complete the rest of the line.stuartheath wrote:i dont suppose someone could break that script down to me so I can actually make sense of what its actually doing?
The echo command, combined with the Pipe, "|" feeds the line of BC script into the
bc -l starts the bc environment with the standard maths library loaded
I've never heard of BC before either. It's a maths language, rather than just a calculator.
The script here just contains the line :
which I'm assuming creates a FOR loop of values form 1 to 2011, and runs the arithmetic each time?scale=2011; 16*a(1/5)-4*a(1/239)
EDIT: I started bc in interactive mode (bc -li) and ran that command. After thinking about it for a few seconds, it printed what (rather aptly), looks like an approximation of pi, presumably to 2011 places?

EDIT 2: The formula used above is Machin's Formula (hence the wiki link!)
- stuartheath
- Posts: 23
- Joined: Mon Jun 18, 2012 9:42 pm
Re: Benchmarking the Pi in the shell
I really want to upgrade my kernal now but I dont want to reset my Pi its been going for 4 days strong 

Re: Benchmarking the Pi in the shell
What the does is first call the "time" command that's built-in to bash (assuming your shell is bash) in order to see how long it takes to do the rest of the command line. The part of the command line has instructions that are piped (via the "|") to the "bc -l" command. The "bc -l" calls the bc calculator with the math library option. The commands piped to bc are "scale=5000" and "a(1)*4". The scale command tells bc that we want precision up to 5000 places in our calculations. the "a(1)*4" computes the arc-tangent (a trigonometric function) of 1 and multiplies that by 4 which computes to the value of the constant known as Pi.
By using the built-in "time" command, you can time a line that includes a pipe. If you were to use the external /usr/bin/time command, you'd have to time just the "bc -l" part as in:
Code: Select all
time echo 'scale=5000;a(1)*4' | bc -l
Code: Select all
echo 'scale=5000;a(1)*4'
By using the built-in "time" command, you can time a line that includes a pipe. If you were to use the external /usr/bin/time command, you'd have to time just the "bc -l" part as in:
Code: Select all
echo 'scale=5000;a(1)*4' | /usr/bin/time bc -l