Raspberry Pi Zero W – Day 2 – Benchmarks

How to Benchmark Your Single-Board Computer

I would like to establish a SOP (standard operating procedure) or  “methodology” going forward so all of you can create your own results. In order for this to be a fair test the following criteria were observed.

  • All CPU and memory tests conducted using Sysbench and/or command line.
  • All Single-Board computers were not contained in a case and used “bare”.
  • All tests using the latest version of that specific systems preferred software.
  • All tests were at ambient temperature before testing began.
  • I accessed the Single-Board computers over an SSH connection.
  • No desktop / X session started unless the tests required the desktop.
  • All test results are a combination of the tests being run 3 times and the mean average was used for the final result.

What is Sysbench

Sysbench is a benchmark suite which allows you to quickly get an impression about system performance which is important if you plan to run a database under intensive load. I will explain how to benchmark your CPU with Sysbench.

Installing Sysbench

From a terminal screen on Debian/Ubuntu/Mint/Raspbian, Sysbench can be installed as follows:

sudo apt-get install sysbench

If you want to learn more about the program you can look at the manual for Sysbench to learn more about its parameters.

man sysbench

CPU Benchmark

You can benchmark your CPU performance as follows:

If you have a single core processor, like a Raspberry Pi Zero, you can use this command:

sysbench –test=cpu –cpu-max-prime=20000 run

Tims-RPI-0-W-CPU-test-1
Tims-RPI-0-W-CPU-test-1

If you have a multicore cpu you can use this command:

sysbench –test=cpu –cpu-max-prime=20000 run –num-threads=4

Tims-Pc-CPU-test-1
Tims-Pc-CPU-test-1

RAM Benchmark

sysbench –test=memory –memory-block-size=1M –memory-total-size=10G run

Tims-RPI-0-W-mem-test-1
Tims-RPI-0-W-mem-test-1
Tims-Pc-mem-test-1
Tims-Pc-mem-test-1

Terminal command line benchmark testing

Integer calculation performance test with  one-line command

time $(i=0; while (( i < 1234567 )); do (( i ++ )); done)

This will return the the time required to crunch the integers between 0 to 1234567.

Tims-RPI-0-W-CPU-test-2
Tims-RPI-0-W-CPU-test-2
Tims-Pc-CPU-test-2
Tims-Pc-CPU-test-2

RAM speed testing

There is no direct method to benchmark a RAM and generally RAM speed  denotes RAM clock speed. It is unnecessary and not conclusive to do this test but this may be considered as an experiment. As you can benchmark this data with changes you do to your system or compared to other systems. 

tmpfs is a RAM based super fast file system, something like a ramdisk, so by doing a read write speed test on a tmpfs mounted folder will give a rough idea about RAM speed. So, let’s have a look at commands below.

mkdir RAM_test
# mount the tmpfs filesystem
sudo mount tmpfs -t tmpfs RAM_test/
cd RAM_test

# write to RAM test
dd if=/dev/zero of=data_tmp bs=1M count=512
# read to RAM test
dd if=data_tmp of=/dev/null bs=1M count=512

Here are the results for the Raspberry Pi Zero W. I achieved around 35 MB/s write speed and 79 MB/s read speed with a 512MB of DDR2 SDRAM.

Tims-RPI-0-W-RAM-test-1
Tims-RPI-0-W-RAM-test-1

On my main PC look at the result ! It’s incredibly fast ! I achieved around 4.6 GB/s write speed and 8.0 GB/s read speed with a 16GB 2400MHz DDR4 RAM.

Tims-RPI-0-W-RAM-test-2
Tims-RPI-0-W-RAM-test-2

Time to clean up what you just did.

cd ..
# umount the tmpfs filesystem
sudo umount tmpfs -t tmpfs RAM_test/
# delete the directory you created
rm -r RAM_test

NOTE: My main computer is an I5 with 16GB DDR 4 ram at 2400MHz
It is a dual boot with Win 10 and Linux Mint

More testing coming up!

 

Raspberry Pi Zero W Headless Setup – Day 1

My Raspberry Pi Zero W arrived and I finally had a chance to sit down and start to do some work with it. I downloaded the latest version of Raspbian, and installed it on a Sandisk Ultra Plus Class 10 microSDHC 16 GB card using Etcher. I did a lot of YouTube watching and read a lot of comments on what worked for setting up the Zero W headless. It worked fairly well for the most part as I am running it via a USB cable off a Windows 10 system.

Raspberry PI Zero W
Raspberry PI Zero W top side

When you are done, locate the file “config.txt” from the Boot drive of the sdcard and insert this at the end

dtoverlay=dwc2

Then save the file, and locate the file called “cmdline.txt” and insert this text right after rootwait

modules-load=dwc2,g_ether

When done, save the file and your going to create 2 more files before your done.  I created both of these files with Notepad++

The first file you want to create is called “ssh” with no extension and completely empty.

The next file you want to create is called “wpa_supplicant.conf” and you want to put the following in it.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
        ssid="YOUR SSID"
        psk="your password"
        key_mgmt=WPA-PSK
}

and you can now insert the sd card into the Raspberry Pi Zero W.

Remember, you need to edit those 2 files and add those 2 files for this to work the way I did it. It is not the only way but it is the way that I got it to work.

To access your Raspberry Pi Zero W from your computer, use ssh client PuTTY and point it to:

pi@raspberrypi.local

Password: raspberry

Now you should be all done!

Raspberry PI Zero W
Raspberry PI Zero W bottom side

Once I was into the Pi I ran the command:

sudo raspi-config

Your going to want to make sure that WiFi is on under network options and that you have VNC on under interfacing options. Turn those both on and then reboot your Pi.

sudo reboot

Watch your Pi and in about 30 seconds you can relaunch your last PuTTy session and get right back into the terminal.

If you want to get into the Pixel desktop you can VNC into it with VNC Viewer and do all the GUI things that you would like to.

NOTE: This is a Raspberry Pi Zero W. It is not very fast in the desktop environment. I suggest that you do not log into your Google services if you are a heavy user of extensions. Your Pi will run very slow.

I’ll get into the benchmark tests, how I did them with examples and how you can do the same things if you want to. I am going to be making a USB dongle out of this as the project progresses and I’ll be adding that information soon.

Conclusion for day 1: not too bad! I was able to get the Pi Zero W to fully run off of one cable. For the person that wants to work in a Linux environment and have Windows at same time this is a dream come true. For the cost of the Pi and a good SD card (that you can reuse on other projects if need be) the investment is very cheap for awesome rewards. More to come!

%d bloggers like this: