Benchmark

From 太極
Revision as of 07:50, 21 October 2021 by Brb (talk | contribs) (→‎Sysbench)
Jump to navigation Jump to search

Geekbench

Geekbench is a cross-platform benchmark that measures the performance of your computer's processor and memory.

Sysbench

sudo apt-get update
sudo apt-get install sysbench
sysbench --num-threads=1 --test=cpu --cpu-max-prime=20000 run
# sysbench version is 0.4.12, Ubuntu 16.04, 10000 events 

sysbench cpu --threads=1 --cpu-max-prime=20000 --time=0 --events=10000 run
# sysbench version 1.0.11, Ubuntu 18.04

See Odroid C4 vs Raspberry Pi 4 (ExplainingComputers) for a video demonstration.

Two websites have a database for benchmarks.

Device Total time (1-thread) Total time (all threads) Average CPU Mark
Intel Core i7-8850H @ 2.6GHz Macbook Pro 2018 (6 cores, 12 threads) brew install sysbench 0.0028s 0.0008s 12407
Xeon E5-1650 (12 threads) 23s 2.5s 11808
Intel i5-4590T (4-core) Dell Optiplex 3020M 5622
Intel i5 8259U (4-core) NUC8i5BEH 4-core 8-thread 20.7s 3.2s
AMD Phenom II X6 1055T (6-core) 28s 5.5s 5058
Intel Core2 Quad Q9500 @2.8GHz (4-core) 23.8s 6.1s 3542
Intel Pentium J5005 4-core 4-thread 16 4.3s
Intel Core2 Duo E8400 @3.0GHz (2-core) 21.5s 11.5s 2178
Intel Core i3-4010U @ 1.7GHz (4-core) 47.2s 13.4s 2437
Core(TM) i3-3110M @ 2.40GHz (4-core) 35s 10s 3049
Core(TM) i7-2640M CPU @ 2.80GHz (Lenovo T420s) 3933
Atom(TM) z3735G @ 1.33GHz (hp stream 8 2-core) 918
Atom(TM) z2760 @ 1.8GHz (lenovo lynx 2-core) 576
Atom(TM) N270 @ 1.60GHz (EEE PC 2-core) 192s 120s 272
RPi1 (1-core) 1412s
RPi2 (4-core) 768s 191s
RPi3B BCM2837 SoC @ 1.2Ghz (4-core)
RPi3B+ BCM2837 SoC @ 1.4GHz (4-core)
RPi0-W (1-core) 624s
BeagleBlack (1-core) 673s
UDoo (2-core) 603s 302s
UDoo X86 Advanced Celeron N3160 2.24 GHZ turbo speed (2-core, 4 threads) 52s 13s 1472
ODroid xu4 (8-core) 372s 40s

Note that

watch -n1 "cat /proc/cpuinfo | grep \"MHz\""
sudo cat /sys/devices/system/cpu/*/cpufreq/cpuinfo_max_freq

Install 0.4.12 from source

For some reason, the threads option in version 1.0 does not work. See cpu test: single thread and multi-threads get the same result and Question about CPU benchmarking.

If we need to use version 0.4.12, we need to build from the source.

sudo apt install automake autoconf libtool libmysqlclient-dev libssl1.0.0 libssl-dev make

wget http://pkgs.fedoraproject.org/repo/pkgs/sysbench/sysbench-0.4.12.tar.gz/3a6d54fdd3fe002328e4458206392b9d/sysbench-0.4.12.tar.gz
tar zxvf sysbench-0.4.12.tar.gz
cd sysbench-0.4.12/
./autogen.sh
./configure --without-mysql
sudo make # Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
          # ...
          # ../libtool: line 5281: : command not found
sudo make install

Run using Docker

Odroid xu4

$ docker run -it --rm ubuntu:16.04 bash
# apt update
# apt-get install sysbench
# sysbench --num-threads=8 --test=cpu --cpu-max-prime=20000 run

sysbench 0.4.12:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 8
Additional request validation enabled.


Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000


Test execution summary:
    total time:                          39.5979s
    total number of events:              10000
    total time taken by event execution: 316.5830
    per-request statistics:
         min:                                 23.31ms
         avg:                                 31.66ms
         max:                                 73.12ms
         approx.  95 percentile:              37.96ms

Threads fairness:
    events (avg/stddev):           1250.0000/201.36
    execution time (avg/stddev):   39.5729/0.01

# sysbench --help 
Usage:
  sysbench [general-options]... --test=<test-name> [test-options]... command

General options:
  --num-threads=N            number of threads to use [1]
  --max-requests=N           limit for total number of requests [10000]
  --max-time=N               limit for total execution time in seconds [0]
  --forced-shutdown=STRING   amount of time to wait after --max-time before forcing shutdown [off]
  --thread-stack-size=SIZE   size of stack per thread [32K]
  --init-rng=[on|off]        initialize random number generator [off]
  --test=STRING              test to run
  --debug=[on|off]           print more debugging info [off]
  --validate=[on|off]        perform validation checks where possible [off]
  --help=[on|off]            print help and exit
  --version=[on|off]         print version and exit

Compiled-in tests:
  fileio - File I/O test
  cpu - CPU performance test
  memory - Memory functions speed test
  threads - Threads subsystem performance test
  mutex - Mutex performance test
  oltp - OLTP test

Commands: prepare run cleanup help version

See 'sysbench --test=<name> help' for a list of options for each test.

Directly

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"

$ apt install sysbench # 1.0.11
$ sysbench cpu --threads=8 --cpu-max-prime=20000 --time=0 --events=10000 run
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 8
Initializing random number generator from current time


Prime numbers limit: 20000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:   221.17

General statistics:
    total time:                          45.2074s
    total number of events:              10000

Latency (ms):
         min:                                 25.98
         avg:                                 36.14
         max:                                 69.89
         95th percentile:                     44.98
         sum:                             361398.71

Threads fairness:
    events (avg/stddev):           1250.0000/246.26
    execution time (avg/stddev):   45.1748/0.01

Run sysbench 0.4.12 using singularity

  1. Install singularity either from pre-build binary or source (See the 'Docs' under https://sylabs.io/singularity/)
  2. Create a new sub and build a container
  3. 'Execute' the container
# step 1: the following method installed an old version (2.6.1) of singularity
#         
$ wget -O- http://neuro.debian.net/lists/bionic.us-nh.libre | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
$ sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
$ sudo apt update
$ sudo apt-get install singularity-container
$ singularity --version

# step 2
$ mkdir sysbench; cd sysbench
$ nano sysbench.def 
$ sudo singularity build sysbench0412 sysbench.def

# step 3
$ singularity exec sysbench0412 sysbench --num-threads=1 --test=cpu --cpu-max-prime=20000 --validate run
$ singularity exec sysbench0412 sysbench --num-threads=4 --test=cpu --cpu-max-prime=20000 --validate run

where the definition file <Singularity> (recall Ubuntu 16.04 still has the old version of sysbench) is

$ cat sysbench.def
Bootstrap: docker
From: ubuntu:16.04

%post
    apt-get -y update
    apt-get -y install sysbench

%environment
    export LC_ALL=C
    export PATH=/usr/games:$PATH

Interestingly, the container build using singularity 2.6.1 also works on singularity 3.5.0 (compile from source).

nbench

wget http://www.tux.org/~mayer/linux/nbench-byte-2.2.3.tar.gz
tar xzvf nbench-byte-2.2.3.tar.gz
cd nbench-byte-2.2.3
make
./nbench

geekbench

https://www.geekbench.com/

Google: how to run geekbench on the raspberry pi

CPU stress test

How to Impose High CPU Load and Stress Test on Linux Using ‘Stress-ng’ Tool

  • stress
    sudo apt-get install stress
    uptime; sudo stress --cpu  8 --timeout 20; uptime   # 8 cores, 20 seconds
    
  • stress-ng
    sudo apt-get install stress-ng    
    uptime; sudo stress-ng --cpu 8 --timeout 60 --metrics-brief; uptime 
    uptime; sudo stress-ng --cpu 4 --cpu-method fft --timeout 2m; uptime
    uptime; sudo stress-ng --hdd 5 --hdd-ops 100000; uptime
    uptime; sudo stress-ng --cpu 4 --io 4 --vm 1 --vm-bytes 1G --timeout 60s --metrics-brief; uptime
    

CPU/GPU overlock

3 Ways to Check If Your CPU or GPU Is Overclocked

Hardinfo (GUI)

sudo apt install hardinfo (this will appear in administration as “System Profiler & Benchmark”). See Odroid C4 vs Raspberry Pi 4.

Simple C program

See Time the iterations from 0 to_2147483647

Python vs C

How fast is C++ compared to Python?

R program

Gross inefficiency in influence.lm, r-source on github

Videos

Raspberry Pi 4B vs Jetson Nano

On Ubuntu, use one of the following commands to find out the graphics card information.

  • sudo lshw -C display
  • lspci | grep -i --color 'vga\|3d\|2d'

Disk speed test

KDiskMark (GUI)

KDiskMark Is A GUI HDD / SSD Benchmark Tool For Linux (Similar To CrystalDiskMark)

dd

Linux and Unix Test Disk I/O Performance With dd Command

  • Test write speed
$ sync; dd if=/dev/zero of=tempfile bs=1M count=1024; sync

# External storage
$ sync; dd if=/dev/zero of=/media/user/MyUSB/tempfile bs=1M count=1024; sync
  • Test read speed
$ dd if=tempfile of=/dev/null bs=1M count=1024  # do not use this

# Clear the cache
$ sudo /sbin/sysctl -w vm.drop_caches=3
$ dd if=tempfile of=/dev/null bs=1M count=1024  # consistent with 'disks' utility

hdparm

hdparm is a Linux command line utility that allows to set and view hardware parameters of hard disk drives. -t and --direct measures data transfer rate but bypassing hard drive's buffer cache memory thus reading directly from the disk.

lsblk   # find the root "/" device

sudo hdparm -t --direct /dev/mmcblk0p1  # eg internal
sudo hdparm -t --direct /dev/mmcblk0p2  # eg sd card
sudo hdparm -t --direct /dev/sda1       # eg USB 
sudo hdparm -Tt /dev/sda
sudo hdparm -t /dev/vdb                 # Measure Hard Disk Device Read Speed
sudo hdparm -T /dev/vdb                 # Measure Hard Disk Cache Read Speed
# Reading cache will give more higher performance than reading 
# from disk because only the cached data will be used and tested.

hdparm -I /dev/sda                      # show information about disk

Example: Silicon-power 512GB ssd. The box says it can read up to 560MB/s & write up to 530MB/s. Below is a test result running on NUC Pentium Silver J5005 CPU.

$ sudo hdparm -t --direct /dev/sdb1
[sudo] password for brb: 

/dev/sdb1:
 Timing O_DIRECT disk reads: 1068 MB in  3.01 seconds = 355.34 MB/sec

On UDOO x86, the SSD is 341.77MB/s. The eMMC speed on UDOO x86 is 130MB/s. A portable HDD has a speed 24-29MB/s.

On ODroid x4, the eMMC is 150MB/s.

On phenom server, Samsung SSD 860 EVO 500GB is 235 MB/s, the HDD speed is 150MB/s (WD black WD4003FZEX 4TB, 2013) and 68MB/s (ST ST3640323as 640GB, 2014).

On Raspberry Pi 3B (sudo apt-get install hdparm), the microSD speed is 22MB/s only. The same SSD plugged to a USB2 port has a speed 34MB/s only.

on Dell t3600 Xeon E5-1650, the HDD (WD Blue 3TB 5400 rpm) speed is 50MB/s and the external USB (WD My Book 4T) is 25MB/s (216.50 kB/s before waking up).

Odroid C4 vs Raspberry Pi 4 Micro SD Card, USB 3.0 SSD, eMMC module.

Website loading

# http
$ curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null http://192.168.1.88/wiki/index.php/C

# https
$ curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nAppCon Time:\t\t%{time_appconnect}\nRedirect Time:\t\t%{time_redirect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://taichimd.us/mediawiki/index.php/C

Lookup Time:		0.004311
Connect Time:		0.010050
AppCon Time:		0.049561 (https only)
Redirect Time:		0.000000 (https only)
Pre-transfer Time:	0.049659
Start-transfer Time:	5.035105

Total Time:		5.174981
$ wget -c https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py
$ python httpstat.py https://taichimd.us/mediawiki/index.php/C
...
  DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
[     4ms    |       8ms      |     34ms      |      31300ms      |       169ms      ]
             |                |               |                   |                  |
    namelookup:4ms            |               |                   |                  |
                        connect:12ms          |                   |                  |
                                    pretransfer:46ms              |                  |
                                                      starttransfer:31346ms          |
                                                                                 total:31515ms

ApacheBench (ab)

Network speed

iperf: network speed test between two boxes

  • https://iperf.fr/
  • How To Use iPerf To Test Network Speed From Host To Host. The default port for iPerf 3 is 5201. iPerf 2 default port is 5001.
    # Server
    iperf3 -s
    
    # Client
    iperf3 -c XXX.XXX.X.XX
    

    Test on Raspberr Pi 3B+ and ODroid Xu4

    client not matter, ethernet cable not matter
    
    server: pi3b+ running ubuntu 20.04.1 64-bit
    [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
    [  4]   0.00-1.00   sec  39.3 MBytes   329 Mbits/sec    1    239 KBytes       
    [  4]   1.00-2.00   sec  38.2 MBytes   320 Mbits/sec    0    270 KBytes
    
    server: pi3b+ running raspberry pi OS lite (buster) 32-bit 
    SAME result as above. Note Pi 3B+ ethernet is slower than Udoo Quad
    
    server: odroid xu4 ubuntu 20.04.1 64-bit
    [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
    [  4]   0.00-1.00   sec   109 MBytes   911 Mbits/sec    0    334 KBytes       
    [  4]   1.00-2.00   sec   107 MBytes   900 Mbits/sec    0    334 KBytes
    
    server: Udoo Dual ubuntu 20.04.1/Armbian 20.08 Focal 32-bit
    [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
    [  4]   0.00-1.00   sec  63.8 MBytes   535 Mbits/sec    0   1.30 MBytes       
    [  4]   1.00-2.00   sec  54.9 MBytes   460 Mbits/sec    0   1.33 MBytes
    

SSH speed test

Linux Fu

yes | pv | ssh [email protected]_host "cat >/dev/null"