├── todo.txt ├── README.md ├── changelog.txt ├── linux-bench-suse-streamlined.sh ├── linux-bench-suse.sh ├── linux-bench-minimal.sh ├── linux-bench.sh └── linux-bench-docker.sh /todo.txt: -------------------------------------------------------------------------------- 1 | #Future ideas/plans/hopes/dreams 2 | 3 | #Header needs work... read it and you will see. 4 | #proxy configuration either prompted or just hardcoded per run. 5 | # gui menu, yeah I am dreaming... 6 | # work dir 7 | # separate downloads from benchmark runs. 8 | # log file as STHBench_hostname_timestamp.log 9 | # Run options 10 | # proxy variables maybe... 11 | # upload options... 12 | # separate or included results parsing script. 13 | # add error checking on downloads... 14 | # Else options for runtime... currently do nothing 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | (C) 2013-2016 ServeTheHome.com and ServeThe.biz 2 | 3 | Linux-Bench - A System Benchmark and comparison tool created by the STH community. 4 | 5 | Linux-Bench is a sscript that runs hardinfo, Unixbench 5.1.3, c-ray 1.1, STREAM, OpenSSL, sysbench (CPU), 6 | crafty, redis, NPB, NAMD, and 7-zip benchmarks 7 | 8 | Linux-Bench must be run as root or using a su prompt to automate download and installation of benchmarks 9 | If running in a virtual environment, export VIRTUAL=TRUE before running. Automatically set for Docker. 10 | 11 | For more information go: 12 | https://forums.servethehome.com/index.php?forums/linux-bench/ 13 | 14 | Authors: Patrick Kennedy, Charles Nguyen (Chuckleb), Patriot, nitrobass24, mir 15 | 16 | 17 | Latest development versions are available on the GitHub site: https://github.com/STH-Dev/STHbench.sh 18 | 19 | If you find bugs, verify you are on the latest version and then post in: 20 | https://forums.servethehome.com/index.php?forums/linux-bench/ 21 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | 12.16 Fixed: 2 | -p -e now set variables that echo after logging starts...rather than echoing beforehand 3 | version module called after setup so that it is also logged. 4 | email and private currently printed out in setup, can be moved to seperate module if needed. 5 | 6 | 12.15 Added: 2 flags 7 | -p Private Result, results will not be in the public database 8 | -e Email results, a perfect pairing with private results. 9 | use -e email@email.net 10 | 11 | 12.14 Fixed: Added better proc/core detection 12 | Added: Rudimentary detection of ARM vs x86 13 | Added: Printes out version of benchmark 14 | 12.13 Modified: Modified: Upload script to submit results 15 | strtoll library function is returning zero content length 16 | which makes Curl_readwrite in lib/transfer.c quit. 17 | It works for transfer -encoding type chunked as there it 18 | ignores content length and keep reading so this explains why 19 | it works for few sites and fails for rest. Implemented custom 20 | solution. 21 | 12.12 Added: Upload script to submit results 22 | Modified: Renamed script to linux-bench.sh 23 | Fixed: p7zip make command caused p7zip to hang, had a hanging -j 24 | 12.11 Modified: Moved all installers into new install routine and localized the install. 25 | Fixed: Redis - cleaned up logic to make it run, reduced iterations to improve speed 26 | Modified: Cleaned up script to toally remove PTS 27 | Created: todo.txt for items to do and changelog.txt to document changes 28 | Fixed: Used a better method to detect Docker 29 | Added: Checks for environment VIRTUAL and if unset, defaults to FALSE. Docker will set to "TRUE" 30 | and users should set to "TRUE" if running virtualized. 31 | Added: detect for missing repos and install for Ubuntu 32 | 12.10 Fixed: OpenSSL 33 | Moved: Cleanup functions within each test 34 | Added: time in front of each test 35 | Modified: Cleaned up installers - NAMD, p7zip 36 | 12.09 Added: p7zip 37 | 12.08 Fixed: Removed PTS from standard run to cover heartbleed bug. 38 | Added: OSSL multi threaded support to replace PTS, lscpu also run without flags. 39 | 12.07 Fixed: Detection of lscpu for Ubuntu. 40 | Added: Detect Docker environment to skip updates/installs 41 | 12.06 Fixed: redis config in wrong directory. 42 | 12.05 Updated: OpenSSL to latest revision free of heartbleed. 43 | 12.04 Added: Menu, flags: hVR. Which call: help, Version, Revision History. 44 | 12.03 Fixed: broken link to apoa1.tar.gz 45 | 12.02 Seperated Benchmark Download from Runtime. 46 | 12.01 Fixed: SLES OS detection. Added: revhist, version, modules and a proper header. 47 | 12.0 Modularized neatened. 48 | 11.0 Deprecated crafty benchmark, too single threaded. 49 | 10.0 Added: NAMD benchmark. Updated: STREAM benchmark (non-PTS) (I don't see it changed) 50 | 9.0 Nothing according to diff... 51 | Updated: lowered prime problem size for sysbench. 52 | 8.0 Added: STREAM, OpenSSL, unzip,crafty benchmarks and lscpu logging. 53 | 7.0 Added: root check, removal code for benchmarks. Updated: Debian installation. 54 | 6.0 Fixed: Installer. Now redis-server shuts down after benchmarking is complete. 55 | 5.0 Fixed: Debian install and redis. 56 | 4.0 Fixed: redis-benchmark issue under some OSes and adds a 6379.conf file for the benchmark 57 | 3.0 Fixed: OS detection for Ubuntu including development/ daily builds) 58 | 2.0 Added: sysbench (CPU test, redis), Removed apt-get spam(1k lines), Added CentOS support 59 | 1.0 Intial release. 60 | -------------------------------------------------------------------------------- /linux-bench-suse-streamlined.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Linux-Bench CPU Benchmark Script for OpenSUSE 4 | # (C) 2013-2016 ServeTheHome.com and ServeThe.biz 5 | # 6 | # Linux-Bench - A System benchmark and comparison tool created by the STH community. 7 | # 8 | # Linux-Bench is a sscript that runs hardinfo, Unixbench 5.1.3, c-ray 1.1, STREAM, OpenSSL, sysbench (CPU), 9 | # crafty, redis, NPB, NAMD, and 7-zip benchmarks without manual intervention. 10 | # 11 | # Linux-Bench must be run as root or using a su prompt to automate download and installation of benchmarks 12 | # 13 | # For more information go: 14 | # http://linux-bench.com 15 | # 16 | # Authors: Patrick Kennedy, Charles Nguyen (Chuckleb), Patriot, nitrobass24, mir, Frank DiDonato (LOGiCELL, Inc.) 17 | # 18 | # Latest development versions are available on the GitHub site: https://github.com/STH-Dev/linux-bench/ 19 | # 20 | # If you find bugs, verify you are on the latest version and then post in: 21 | # https://forums.servethehome.com/index.php?forums/linux-bench/ 22 | # 23 | # To view your results, check the reference ID at the end of the log file generated. You can copy and paste 24 | # the ID number here: http://beta.linux-bench.com/ and see parsed results. 25 | ################################################################################################################################ 26 | 27 | #Current Version 28 | rev='12.17' 29 | 30 | version() 31 | { 32 | cat << EOF 33 | ############################################################## 34 | # (c) 2013-2016 ServeTheHome.com and ServeThe.biz 35 | # 36 | # Linux-Bench $rev 37 | # - Linux-Bench the STH Benchmark Suite 38 | ############################################################### 39 | 40 | EOF 41 | } 42 | 43 | 44 | usage() 45 | { 46 | cat << EOF 47 | 48 | usage: $0 49 | 50 | This is the STH benchmark suite. 51 | 52 | ARGS: 53 | ARG1 - none required for now 54 | ARG2 - none required for now 55 | ARG3 - none required for now 56 | 57 | OPTIONAL ARGS: 58 | ARG -- script_option_1 script_option-2 59 | 60 | OPTIONS: 61 | -h help (usage info) 62 | -V Version of Linux-Bench 63 | -p Private Result, results will not be in the public database 64 | -e Email results, a perfect pairing with private results. 65 | use -e email@email.net 66 | 67 | 68 | ENVIRONMENT VARIABLES: 69 | 70 | VIRTUAL = If unset, value is FALSE. Set to TRUE if running virtualized (automatically set for Docker) 71 | 72 | EOF 73 | } 74 | 75 | 76 | # Verify if the script is executed with Root Privileges # 77 | rootcheck() 78 | { 79 | if [[ $EUID -ne 0 ]]; then 80 | echo "This script must be run as root" 81 | echo "Ex. "sudo ./linux-bench.sh"" 82 | exit 1 83 | fi 84 | } 85 | 86 | 87 | #Set Functions 88 | setup() 89 | { 90 | benchdir=`/root` 91 | NEED_PTS=1 92 | 93 | date_str="+%Y_%m%d_%H%M%S" 94 | full_date=`date $date_str` 95 | host=$(hostname) 96 | log="linux-bench"$rev"_"$host"_"$full_date.log 97 | if [ -f /.dockerinit ] ; then 98 | log=/data/"linux-bench"$rev"_"$host"_"$full_date.log 99 | fi 100 | 101 | if [ -n "$isprivate" ]; then 102 | echo $isprivate 103 | fi 104 | 105 | if [ -n "$email" ]; then 106 | echo $email 107 | fi 108 | 109 | #outdir=$host"_"$full_date 110 | #mkdir $outdir 111 | } 112 | 113 | # Detects which OS and if it is Linux then it will detect which Linux Distribution. 114 | whichdistro() 115 | { 116 | OS=`uname -s` 117 | REV=`uname -r` 118 | MACH=`uname -m` 119 | 120 | if [ "${OS}" = "SunOS" ] ; then 121 | OS=Solaris 122 | DIST=Solaris 123 | ARCH=`uname -p` 124 | OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" 125 | elif [ "${OS}" = "AIX" ] ; then 126 | DIST=AIX 127 | OSSTR="${OS} `oslevel` (`oslevel -r`)" 128 | 129 | elif [ "${OS}" = "Linux" ] ; then 130 | KERNEL=`uname -r` 131 | 132 | if [ -f /etc/redhat-release ] ; then 133 | DIST='RedHat' 134 | PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` 135 | REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` 136 | 137 | elif [ -f /etc/centos-release ] ; then 138 | DIST='CentOS' 139 | PSUEDONAME=`cat /etc/centos-release | sed s/.*\(// | sed s/\)//` 140 | REV=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//` 141 | 142 | elif [ -f /etc/SuSE-release ] ; then 143 | DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` 144 | REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //` 145 | 146 | elif [ -f /etc/mandrake-release ] ; then 147 | DIST='Mandrake' 148 | PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` 149 | REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` 150 | 151 | elif [ -f /etc/debian_version ] ; then 152 | DIST="Debian" 153 | PSUEDONAME=`cat /etc/debian_version` 154 | REV="" 155 | if [ `grep DISTRIB_ID= /etc/lsb-release | cut -d"=" -f2` = "Ubuntu" ] ; then 156 | DIST="Ubuntu" 157 | UBUNTU_RELEASE=`lsb_release -sc` 158 | REPO1="deb http://us.archive.ubuntu.com/ubuntu/ " 159 | REPO1END=" universe" 160 | echo $REPO1 $UBUNTU_RELEASE $REPO1END > /etc/apt/sources.list.d/linuxbench.list 161 | fi 162 | 163 | elif [ -f /etc/UnitedLinux-release ] ; then 164 | DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" 165 | 166 | else 167 | DIST='Not detected' 168 | fi 169 | 170 | OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})" 171 | fi 172 | } 173 | 174 | 175 | # Update and install required packages 176 | dlDependancies() 177 | { 178 | if [ -f /.dockerinit ] ; then 179 | echo "In a Docker container, no updates run." 180 | VIRTUAL="TRUE" 181 | } 182 | 183 | 184 | # Display script output and append to log 185 | benchlog() 186 | { 187 | exec > >(tee --append $log) 188 | echo $ref >> $log 189 | exec 2>&1 190 | echo ${OSSTR} 191 | } 192 | 193 | 194 | extract() 195 | { 196 | if [ -e ./$appbin ] ; then 197 | echo "$apptgz already installed" 198 | elif [ -e ./$apptgz ] ; then 199 | tar $tgzstring $apptgz 200 | else 201 | wget $appdlpath 202 | tar $tgzstring $apptgz 203 | fi 204 | } 205 | 206 | localextract() 207 | { 208 | if [ -e ./$appbin ] ; then 209 | echo "$apptgz already installed" 210 | elif [ -e ./$apptgz ] ; then 211 | tar $tgzstring $apptgz 212 | else 213 | cp $benchdir/benchfiles/$apptgz $benchdir 214 | tar $tgzstring $apptgz 215 | fi 216 | } 217 | 218 | 219 | #System information and log capture. 220 | sysinfo() 221 | { 222 | eval "strings `which lscpu`" | grep -q version ; 223 | if [ $? = 0 ] ; then 224 | lscpu 225 | lscpu -V 226 | lscpu -e 227 | else 228 | lscpu; 229 | fi 230 | : ${VIRTUAL:=FALSE} 231 | echo "VIRTUAL="$VIRTUAL 232 | 233 | 234 | # Check to see if the CPU is an Intel/AMD or ARM 235 | # This is a simple check for now. 236 | 237 | cpu_check=$(grep 'CPU architecture' /proc/cpuinfo) 238 | if [ $? -ne 0 ] ; then 239 | CPU=x86 240 | else 241 | CPU=ARM; 242 | fi 243 | 244 | echo "CPU="$CPU 245 | 246 | echo "Linux-Bench Version="$rev 247 | } 248 | 249 | proc_define() 250 | { 251 | # Physical sockets 252 | sockets=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 253 | 254 | # Physical Cores 255 | if [[ $CPU == "x86" ]] ; then 256 | procs=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 257 | pcores=$(grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2) 258 | cores=$((procs*pcores)) 259 | elif [[ $CPU == "ARM" ]] ; then 260 | cores=$(grep "processor" /proc/cpuinfo | wc -l) 261 | else 262 | echo "Unknown CPU" 263 | fi 264 | 265 | # Virtual Cores (include threads) 266 | vcores=$(grep "processor" /proc/cpuinfo | wc -l) 267 | threads=$vcores 268 | nproc=$vcores 269 | 270 | } 271 | 272 | 273 | # HardInfo 274 | hardi() 275 | { 276 | cd $benchdir 277 | echo "Running HardInfo test" 278 | hardinfo --generate-report --report-format text 279 | } 280 | 281 | # UnixBench 5.1.3 282 | ubench() 283 | { 284 | cd $benchdir 285 | echo "Building UnixBench" 286 | cp /root/benchfiles/UnixBench5.1.3.tgz $benchdir 287 | tar -zxf UnixBench5.1.3.tgz 288 | 289 | cd UnixBench 290 | mv ../fix-limitation.patch . 291 | make 292 | patch Run fix-limitation.patch 293 | echo "Running UnixBench" 294 | ./Run dhry2reg whetstone-double syscall pipe context1 spawn execl shell1 shell8 shell16 295 | cd $benchdir 296 | 297 | } 298 | 299 | # C-Ray 1.1 300 | cray() 301 | { 302 | cd $benchdir 303 | 304 | appbase=c-ray-1.1 305 | apptgz=c-ray-1.1.tar.gz 306 | tgzstring=xfz 307 | appbin=$appbase/c-ray-mt 308 | appdlpath=http://www.futuretech.blinkenlights.nl/depot/$apptgz 309 | localextract 310 | 311 | echo "Running C-Ray test" 312 | cd c-ray-1.1 && make 313 | echo "c-ray Easy Test" 314 | cat scene | ./c-ray-mt -t $threads -s 7500x3500 > foo.ppm 315 | echo "c-ray Medium Test" 316 | cat sphfract | ./c-ray-mt -t $threads -s 1920x1200 -r 8 > foo.ppm 317 | echo "c-ray Hard Test" 318 | cat sphfract | ./c-ray-mt -t $threads -s 3840x2160 -r 8 > foo.ppm 319 | cd $benchdir 320 | rm -rf $appbase* 321 | 322 | } 323 | 324 | # STREAM by Dr. John D. McCalpin 325 | stream() 326 | { 327 | cd $benchdir 328 | echo "Building STREAM" 329 | 330 | if [ -e stream.c ] ; then 331 | echo "Stream downloaded" 332 | else 333 | cp /root/benchfiles/stream.c $benchdir 334 | fi 335 | 336 | gcc stream.c -O3 -march=native -fopenmp -o stream-me 337 | 338 | export OMP_NUM_THREADS=$cores 339 | export GOMP_CPU_AFFINITY=0-$((cores-1)) 340 | echo $GOMP_CPU_AFFINITY 341 | 342 | echo "Running STREAM test" 343 | ./stream-me 344 | 345 | cd $benchdir 346 | rm -rf stream-me stream.c 347 | } 348 | 349 | # OpenSSL 350 | OSSL() 351 | { 352 | cd $benchdir 353 | 354 | appbase=openssl-1.0.1g 355 | apptgz=openssl-1.0.1g.tar.gz 356 | tgzstring=xfz 357 | appbin=$appbase/apps/openssl 358 | appdlpath=http://www.openssl.org/source/$apptgz 359 | localextract 360 | 361 | cd openssl-1.0.1g/ 362 | echo "Building OpenSSL" 363 | ./config no-zlib 2>&1 >> /dev/null 364 | make 2>&1 >> /dev/null 365 | echo "Running OpenSSL test" 366 | ./apps/openssl speed rsa4096 -multi $nproc 367 | 368 | cd $benchdir 369 | rm -rf openssl* 370 | 371 | 372 | } 373 | 374 | # sysbench CPU test prime 375 | sysb() 376 | { 377 | cd $benchdir 378 | echo "Running sysbench CPU Single Thread" 379 | sysbench --test=cpu --cpu-max-prime=30000 run 380 | echo "Running sysbench CPU Multi-Threaded" 381 | sysbench --num-threads=$nproc --test=cpu --cpu-max-prime=300000 run 382 | } 383 | 384 | 385 | # redis Benchmark based on feedback. Next step is to add memchached as seen here: http://oldblog.antirez.com/post/redis-memcached-benchmark.html 386 | red() 387 | { 388 | 389 | cd $benchdir 390 | echo "Building Redis" 391 | 392 | cp /root/benchfiles/redis-stable.tar.gz $benchdir 393 | tar xzf redis-stable.tar.gz && cd redis-stable && make install 394 | cp utils/redis_init_script /etc/init.d/redis_6379 395 | mkdir -p /var/redis/6379 396 | mkdir -p /etc/redis 397 | cp 6379.conf /etc/redis 398 | 399 | service redis_6379 start 400 | 401 | # Original redis benchmark set/ get test 402 | 403 | echo "Running Redis test" 404 | redis-benchmark -n 1000000 -t set,get -P 32 -q -c 200 405 | 406 | BIN=redis-benchmark 407 | 408 | payload=32 409 | iterations=10000 410 | keyspace=100000 411 | 412 | for clients in 1 5 10 25 50 75 100 413 | do 414 | SPEED=0 415 | for dummy in 0 1 2 416 | do 417 | S=$($BIN -n $iterations -r $keyspace -d $payload -c $clients | grep 'per second' | tail -1 | awk '{print $1}') 418 | VALUE=$(echo $S | awk '{printf "%.0f",$1}') 419 | if [ $(($VALUE > $SPEED)) != 0 ] 420 | then 421 | SPEED=$VALUE 422 | fi 423 | done 424 | echo "$clients $SPEED" 425 | done 426 | 427 | redis-cli shutdown 428 | 429 | cd $benchdiry 430 | 431 | } 432 | 433 | 434 | # NPB Benchmarks 435 | NPB() 436 | { 437 | cd $benchdir 438 | 439 | apptgz=NPB3.3.1.tar.gz 440 | appbin=NPB3.3.1/NPB3.3-OMP 441 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 442 | tgzstring=xfz 443 | localextract 444 | 445 | cd NPB3.3.1/NPB3.3-OMP/ 446 | echo "Building NPB" 447 | 448 | # Use the provided makefile definitions 449 | cp config/NAS.samples/make.def.gcc_x86 config/make.def 450 | 451 | # Define which tests to build 452 | echo "ft A" >> config/suite.def 453 | #echo "mg A" >> config/suite.def 454 | #echo "sp A" >> config/suite.def 455 | #echo "lu A" >> config/suite.def 456 | echo "bt A" >> config/suite.def 457 | #echo "is A" >> config/suite.def 458 | #echo "ep A" >> config/suite.def 459 | #echo "cg A" >> config/suite.def 460 | #echo "ua A" >> config/suite.def 461 | #echo "dc A" >> config/suite.def 462 | 463 | make suite 464 | 465 | export OMP_NUM_THREADS=$cores 466 | 467 | echo "Running NPB tests" 468 | bin/bt.A.x 469 | bin/ft.A.x 470 | 471 | cd $benchdir 472 | rm -rf NPB* 473 | } 474 | 475 | 476 | # NAMD Benchmark http://www.ks.uiuc.edu/Research/namd/performance.html 477 | NAMD() 478 | { 479 | echo "Building NAMD" 480 | cd $benchdir 481 | 482 | appbase=NAMD_2.9_Linux-x86_64-multicore 483 | apptgz=NAMD_2.9_Linux-x86_64-multicore.tar.gz 484 | tgzstring=xfz 485 | appbin=$appbase/namd2 486 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 487 | localextract 488 | 489 | appbase=apoa1 490 | apptgz=apoa1.tar.gz 491 | tgzstring=xfz 492 | appbin=$appbase/apoa1.pdb 493 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 494 | localextract 495 | 496 | echo "Using" $threads "threads" 497 | echo "Running NAMD benchmark... (will take a while)" 498 | 499 | cd NAMD_2.9_Linux-x86_64-multicore 500 | timeperstep=$(./namd2 +p$threads +setcpuaffinity ../apoa1/apoa1.namd | grep "Benchmark time" | tail -1 | cut -d" " -f6) 501 | 502 | echo "Time per step" $timeperstep 503 | 504 | cd $benchdir 505 | rm -rf NAMD* apoa1* 506 | 507 | } 508 | 509 | # p7zip 510 | p7zip() 511 | { 512 | cd $benchdir 513 | 514 | appbase=p7zip_9.20.1 515 | apptgz=p7zip_9.20.1_src_all.tar.bz2 516 | tgzstring=xfj 517 | appbin=p7zip_9.20.1/bin/7za 518 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 519 | localextract 520 | 521 | echo "Building p7zip" 522 | cd $appbase 523 | make 2>&1 >> /dev/null 524 | 525 | echo "Starting 7zip benchmark, this will take a while" 526 | bin/7za b >> output.txt 527 | 528 | compressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f4) 529 | decompressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f7) 530 | 531 | echo "Compress speed (MIPS):" $compressmips 532 | echo "Decompress speed (MIPS):" $decompressmips 533 | 534 | cd $benchdir 535 | rm -rf p7zip* 536 | 537 | 538 | } 539 | 540 | runBenches() 541 | { 542 | #Individual modules run below...comment them out to prevent them from running. 543 | #echo ${iterations:=1} passes 544 | # while [ $iterations -gt 0 ] ; do 545 | echo "hardinfo" 546 | time hardi 547 | #commenting out UnixBench to make faster for testing 548 | # echo "ubench" 549 | # time ubench 550 | echo "cray" 551 | time cray 552 | echo "stream" 553 | time stream 554 | echo "OSSL" 555 | time OSSL 556 | echo "sysbench" 557 | time sysb 558 | echo "redis" 559 | time red 560 | echo "NPB" 561 | time NPB 562 | echo "NAMD" 563 | time NAMD 564 | echo "p7zip" 565 | time p7zip 566 | # let iterations-=1 567 | # done 568 | 569 | } 570 | 571 | 572 | 573 | # Runtime This is where everything is actually run from and called... 574 | # 575 | # This is where a menu would go for runtime options... 576 | # 577 | 578 | main() 579 | { 580 | rootcheck 581 | 582 | while getopts "hVRpe:" arg; do 583 | 584 | case $arg in 585 | h) 586 | usage 587 | exit 1 588 | ;; 589 | V) 590 | version 591 | exit 1 592 | ;; 593 | p) 594 | isprivate="Private Result" 595 | ;; 596 | e) 597 | email="Send Linux-Bench result to: $OPTARG" 598 | ;; 599 | \?) 600 | usage 601 | exit 1 602 | ;; 603 | esac 604 | done 605 | 606 | echo "setup" 607 | setup 608 | echo "version" 609 | version 610 | echo "whichdistro" 611 | whichdistro 612 | echo "dlDep" 613 | dlDependancies 614 | echo "benchlog" 615 | benchlog 616 | echo "derpinfo" 617 | sysinfo exiting on sysinfo... 618 | sysinfo 619 | echo "proc_define" 620 | proc_define 621 | echo "run benches" 622 | runBenches 623 | echo "done" 624 | } 625 | 626 | push_data() { 627 | ref=$(date +%S%d$i%s) 628 | echo "ref_link: $ref" 629 | echo "See your results online at: http://beta.linux-bench.com/display/$ref" 630 | mkdir tmpbench && cp $log tmpbench/. 631 | sleep 1s 632 | curl -F file="@./tmpbench/$log" http://parser.linux-bench.com:3000/java-process/uploader -H "Connection: close" 633 | curl --form file="@./tmpbench/$log" --form press=Upload http://beta.linux-bench.com/upload_file/ --trace-ascii dumpfile 634 | rm -rf ./tmpbench/ 635 | } 636 | 637 | # Execute everything in the script 638 | main 639 | push_data 640 | -------------------------------------------------------------------------------- /linux-bench-suse.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Linux-Bench CPU Benchmark Script for OpenSUSE 4 | # (C) 2013-2016 ServeTheHome.com and ServeThe.biz 5 | # 6 | # Linux-Bench - A System benchmark and comparison tool created by the STH community. 7 | # 8 | # Linux-Bench is a sscript that runs hardinfo, Unixbench 5.1.3, c-ray 1.1, STREAM, OpenSSL, sysbench (CPU), 9 | # crafty, redis, NPB, NAMD, and 7-zip benchmarks without manual intervention. 10 | # 11 | # Linux-Bench must be run as root or using a su prompt to automate download and installation of benchmarks 12 | # 13 | # For more information go: 14 | # http://linux-bench.com 15 | # 16 | # Authors: Patrick Kennedy, Charles Nguyen (Chuckleb), Patriot, nitrobass24, mir, Frank DiDonato (LOGiCELL, Inc.) 17 | # 18 | # Latest development versions are available on the GitHub site: https://github.com/STH-Dev/linux-bench/ 19 | # 20 | # If you find bugs, verify you are on the latest version and then post in: 21 | # https://forums.servethehome.com/index.php?forums/linux-bench/ 22 | # 23 | # To view your results, check the reference ID at the end of the log file generated. You can copy and paste 24 | # the ID number here: http://beta.linux-bench.com/ and see parsed results. 25 | ################################################################################################################################ 26 | 27 | #Current Version 28 | rev='12.17' 29 | 30 | version() 31 | { 32 | cat << EOF 33 | ############################################################## 34 | # (c) 2013-2016 ServeTheHome.com and ServeThe.biz 35 | # 36 | # Linux-Bench $rev 37 | # - Linux-Bench the STH Benchmark Suite 38 | ############################################################### 39 | 40 | EOF 41 | } 42 | 43 | 44 | usage() 45 | { 46 | cat << EOF 47 | 48 | usage: $0 49 | 50 | This is the STH benchmark suite. 51 | 52 | ARGS: 53 | ARG1 - none required for now 54 | ARG2 - none required for now 55 | ARG3 - none required for now 56 | 57 | OPTIONAL ARGS: 58 | ARG -- script_option_1 script_option-2 59 | 60 | OPTIONS: 61 | -h help (usage info) 62 | -V Version of Linux-Bench 63 | -p Private Result, results will not be in the public database 64 | -e Email results, a perfect pairing with private results. 65 | use -e email@email.net 66 | 67 | 68 | ENVIRONMENT VARIABLES: 69 | 70 | VIRTUAL = If unset, value is FALSE. Set to TRUE if running virtualized (automatically set for Docker) 71 | 72 | EOF 73 | } 74 | 75 | 76 | # Verify if the script is executed with Root Privileges # 77 | rootcheck() 78 | { 79 | if [[ $EUID -ne 0 ]]; then 80 | echo "This script must be run as root" 81 | echo "Ex. "sudo ./linux-bench.sh"" 82 | exit 1 83 | fi 84 | } 85 | 86 | 87 | #Set Functions 88 | setup() 89 | { 90 | benchdir=`/root/` 91 | NEED_PTS=1 92 | 93 | date_str="+%Y_%m%d_%H%M%S" 94 | full_date=`date $date_str` 95 | host=$(hostname) 96 | log="linux-bench"$rev"_"$host"_"$full_date.log 97 | if [ -f /.dockerinit ] ; then 98 | log=/data/"linux-bench"$rev"_"$host"_"$full_date.log 99 | fi 100 | 101 | if [ -n "$isprivate" ]; then 102 | echo $isprivate 103 | fi 104 | 105 | if [ -n "$email" ]; then 106 | echo $email 107 | fi 108 | 109 | #outdir=$host"_"$full_date 110 | #mkdir $outdir 111 | } 112 | 113 | 114 | # Update and install required packages (Debian) 115 | Update_Install_Debian() 116 | { 117 | apt-get update 118 | apt-get -y install build-essential libx11-dev libglu-dev hardinfo sysbench unzip expect php5-curl php5-common php5-cli php5-gd libfpdi-php gfortran curl 119 | mkdir -p /usr/tmp/ 120 | rm /etc/apt/sources.list.d/linuxbench.list 121 | } 122 | 123 | 124 | # Update and install required packages (CentOS/RHEL) 125 | Update_Install_RHEL() 126 | { 127 | rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 128 | rpm -Uhv http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 129 | yum -y groupinstall "Development Tools" && yum -y install wget sysbench unzip libX11 perl-Time-HiRes mesa-libGLU hardinfo expect php-common glibc.i686 gfortran curl 130 | } 131 | 132 | 133 | # Detects which OS and if it is Linux then it will detect which Linux Distribution. 134 | whichdistro() 135 | { 136 | OS=`uname -s` 137 | REV=`uname -r` 138 | MACH=`uname -m` 139 | 140 | if [ "${OS}" = "SunOS" ] ; then 141 | OS=Solaris 142 | DIST=Solaris 143 | ARCH=`uname -p` 144 | OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" 145 | elif [ "${OS}" = "AIX" ] ; then 146 | DIST=AIX 147 | OSSTR="${OS} `oslevel` (`oslevel -r`)" 148 | 149 | elif [ "${OS}" = "Linux" ] ; then 150 | KERNEL=`uname -r` 151 | 152 | if [ -f /etc/redhat-release ] ; then 153 | DIST='RedHat' 154 | PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` 155 | REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` 156 | 157 | elif [ -f /etc/centos-release ] ; then 158 | DIST='CentOS' 159 | PSUEDONAME=`cat /etc/centos-release | sed s/.*\(// | sed s/\)//` 160 | REV=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//` 161 | 162 | elif [ -f /etc/SuSE-release ] ; then 163 | DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` 164 | REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //` 165 | 166 | elif [ -f /etc/mandrake-release ] ; then 167 | DIST='Mandrake' 168 | PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` 169 | REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` 170 | 171 | elif [ -f /etc/debian_version ] ; then 172 | DIST="Debian" 173 | PSUEDONAME=`cat /etc/debian_version` 174 | REV="" 175 | if [ `grep DISTRIB_ID= /etc/lsb-release | cut -d"=" -f2` = "Ubuntu" ] ; then 176 | DIST="Ubuntu" 177 | UBUNTU_RELEASE=`lsb_release -sc` 178 | REPO1="deb http://us.archive.ubuntu.com/ubuntu/ " 179 | REPO1END=" universe" 180 | echo $REPO1 $UBUNTU_RELEASE $REPO1END > /etc/apt/sources.list.d/linuxbench.list 181 | fi 182 | 183 | elif [ -f /etc/UnitedLinux-release ] ; then 184 | DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" 185 | 186 | else 187 | DIST='Not detected' 188 | fi 189 | 190 | OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})" 191 | fi 192 | } 193 | 194 | 195 | # Update and install required packages 196 | dlDependancies() 197 | { 198 | if [ -f /.dockerinit ] ; then 199 | echo "In a Docker container, no updates run." 200 | VIRTUAL="TRUE" 201 | elif [ "${DIST}" = "CentOS" ] ; then 202 | Update_Install_RHEL 203 | elif [ "${DIST}" = "RedHat" ] ; then 204 | Update_Install_RHEL 205 | elif [ "${DIST}" = "Debian" ] || [ "${DIST}" = "Ubuntu" ] ; then 206 | Update_Install_Debian 207 | fi 208 | } 209 | 210 | 211 | # Display script output and append to log 212 | benchlog() 213 | { 214 | exec > >(tee --append $log) 215 | echo $ref >> $log 216 | exec 2>&1 217 | echo ${OSSTR} 218 | } 219 | 220 | 221 | extract() 222 | { 223 | if [ -e ./$appbin ] ; then 224 | echo "$apptgz already installed" 225 | elif [ -e ./$apptgz ] ; then 226 | tar $tgzstring $apptgz 227 | else 228 | wget $appdlpath 229 | tar $tgzstring $apptgz 230 | fi 231 | } 232 | 233 | 234 | #System information and log capture. 235 | sysinfo() 236 | { 237 | eval "strings `which lscpu`" | grep -q version ; 238 | if [ $? = 0 ] ; then 239 | lscpu 240 | lscpu -V 241 | lscpu -e 242 | else 243 | lscpu; 244 | fi 245 | : ${VIRTUAL:=FALSE} 246 | echo "VIRTUAL="$VIRTUAL 247 | 248 | 249 | # Check to see if the CPU is an Intel/AMD or ARM 250 | # This is a simple check for now. 251 | 252 | cpu_check=$(grep 'CPU architecture' /proc/cpuinfo) 253 | if [ $? -ne 0 ] ; then 254 | CPU=x86 255 | else 256 | CPU=ARM; 257 | fi 258 | 259 | echo "CPU="$CPU 260 | 261 | echo "Linux-Bench Version="$rev 262 | } 263 | 264 | proc_define() 265 | { 266 | # Physical sockets 267 | sockets=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 268 | 269 | # Physical Cores 270 | if [[ $CPU == "x86" ]] ; then 271 | procs=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 272 | pcores=$(grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2) 273 | cores=$((procs*pcores)) 274 | elif [[ $CPU == "ARM" ]] ; then 275 | cores=$(grep "processor" /proc/cpuinfo | wc -l) 276 | else 277 | echo "Unknown CPU" 278 | fi 279 | 280 | # Virtual Cores (include threads) 281 | vcores=$(grep "processor" /proc/cpuinfo | wc -l) 282 | threads=$vcores 283 | nproc=$vcores 284 | 285 | } 286 | 287 | 288 | # HardInfo 289 | hardi() 290 | { 291 | cd $benchdir 292 | echo "Running HardInfo test" 293 | hardinfo --generate-report --report-format text 294 | } 295 | 296 | # UnixBench 5.1.3 297 | ubench() 298 | { 299 | cd $benchdir 300 | echo "Building UnixBench" 301 | wget -N --no-check-certificate https://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz 302 | wget -N http://linuxbench.servethehome.com/benchfiles/fix-limitation.patch 303 | tar -zxf UnixBench5.1.3.tgz 304 | 305 | cd UnixBench 306 | mv ../fix-limitation.patch . 307 | make 308 | patch Run fix-limitation.patch 309 | echo "Running UnixBench" 310 | ./Run dhry2reg whetstone-double syscall pipe context1 spawn execl shell1 shell8 shell16 311 | cd $benchdir 312 | rm -rf UnixBench* fix-limitation.patch 313 | 314 | } 315 | 316 | # C-Ray 1.1 317 | cray() 318 | { 319 | cd $benchdir 320 | 321 | appbase=c-ray-1.1 322 | apptgz=c-ray-1.1.tar.gz 323 | tgzstring=xfz 324 | appbin=$appbase/c-ray-mt 325 | appdlpath=http://www.futuretech.blinkenlights.nl/depot/$apptgz 326 | extract 327 | 328 | echo "Running C-Ray test" 329 | cd c-ray-1.1 && make 330 | echo "c-ray Easy Test" 331 | cat scene | ./c-ray-mt -t $threads -s 7500x3500 > foo.ppm 332 | echo "c-ray Medium Test" 333 | cat sphfract | ./c-ray-mt -t $threads -s 1920x1200 -r 8 > foo.ppm 334 | echo "c-ray Hard Test" 335 | cat sphfract | ./c-ray-mt -t $threads -s 3840x2160 -r 8 > foo.ppm 336 | cd $benchdir 337 | rm -rf $appbase* 338 | 339 | } 340 | 341 | # STREAM by Dr. John D. McCalpin 342 | stream() 343 | { 344 | cd $benchdir 345 | echo "Building STREAM" 346 | 347 | if [ -e stream.c ] ; then 348 | echo "Stream downloaded" 349 | else 350 | wget -N http://www.cs.virginia.edu/stream/FTP/Code/stream.c 351 | fi 352 | 353 | gcc stream.c -O3 -march=native -fopenmp -o stream-me 354 | 355 | export OMP_NUM_THREADS=$cores 356 | export GOMP_CPU_AFFINITY=0-$((cores-1)) 357 | echo $GOMP_CPU_AFFINITY 358 | 359 | echo "Running STREAM test" 360 | ./stream-me 361 | 362 | cd $benchdir 363 | rm -rf stream-me stream.c 364 | } 365 | 366 | # OpenSSL 367 | OSSL() 368 | { 369 | cd $benchdir 370 | 371 | appbase=openssl-1.0.1g 372 | apptgz=openssl-1.0.1g.tar.gz 373 | tgzstring=xfz 374 | appbin=$appbase/apps/openssl 375 | appdlpath=http://www.openssl.org/source/$apptgz 376 | extract 377 | 378 | cd openssl-1.0.1g/ 379 | echo "Building OpenSSL" 380 | ./config no-zlib 2>&1 >> /dev/null 381 | make 2>&1 >> /dev/null 382 | echo "Running OpenSSL test" 383 | ./apps/openssl speed rsa4096 -multi $nproc 384 | 385 | cd $benchdir 386 | rm -rf openssl* 387 | 388 | 389 | } 390 | 391 | crafty() 392 | { 393 | cd $benchdir 394 | wget -N http://www.craftychess.com/crafty-23.4.zip 395 | unzip -o crafty-23.4.zip 396 | cd crafty-23.4/ 397 | export target=LINUX 398 | export CFLAGS="-Wall -pipe -O3 -fomit-frame-pointer $CFLAGS" 399 | export CXFLAGS="-Wall -pipe -O3 -fomit-frame-pointer" 400 | export LDFLAGS="$LDFLAGS -lstdc++" 401 | make crafty-make 402 | chmod +x crafty 403 | ./crafty bench end 404 | 405 | cd $benchdir 406 | rm -rf crafty* 407 | 408 | } 409 | 410 | 411 | 412 | # sysbench CPU test prime 413 | sysb() 414 | { 415 | cd $benchdir 416 | echo "Running sysbench CPU Single Thread" 417 | sysbench --test=cpu --cpu-max-prime=30000 run 418 | echo "Running sysbench CPU Multi-Threaded" 419 | sysbench --num-threads=$nproc --test=cpu --cpu-max-prime=300000 run 420 | } 421 | 422 | 423 | # redis Benchmark based on feedback. Next step is to add memchached as seen here: http://oldblog.antirez.com/post/redis-memcached-benchmark.html 424 | red() 425 | { 426 | cd $benchdir 427 | echo "Building Redis" 428 | 429 | wget http://download.redis.io/redis-stable.tar.gz 430 | tar xzf redis-stable.tar.gz && cd redis-stable && make install 431 | cp utils/redis_init_script /etc/init.d/redis_6379 432 | mkdir -p /var/redis/6379 433 | wget http://linuxbench.servethehome.com/benchfiles/6379.conf 434 | mkdir -p /etc/redis 435 | cp ./6379.conf /etc/redis 436 | 437 | service redis_6379 start 438 | 439 | # Original redis benchmark set/ get test 440 | 441 | echo "Running Redis test" 442 | redis-benchmark -n 1000000 -t set,get -P 32 -q -c 200 443 | 444 | BIN=redis-benchmark 445 | 446 | payload=32 447 | iterations=10000 448 | keyspace=100000 449 | 450 | for clients in 1 5 10 25 50 75 100 451 | do 452 | SPEED=0 453 | for dummy in 0 1 2 454 | do 455 | S=$($BIN -n $iterations -r $keyspace -d $payload -c $clients | grep 'per second' | tail -1 | awk '{print $1}') 456 | VALUE=$(echo $S | awk '{printf "%.0f",$1}') 457 | if [ $(($VALUE > $SPEED)) != 0 ] 458 | then 459 | SPEED=$VALUE 460 | fi 461 | done 462 | echo "$clients $SPEED" 463 | done 464 | 465 | redis-cli shutdown 466 | 467 | cd $benchdir 468 | rm -rf redis* /etc/redis /var/redis* /usr/local/bin/redis-* /etc/init.d/redis_* 469 | 470 | } 471 | 472 | 473 | # NPB Benchmarks 474 | NPB() 475 | { 476 | cd $benchdir 477 | 478 | apptgz=NPB3.3.1.tar.gz 479 | appbin=NPB3.3.1/NPB3.3-OMP 480 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 481 | tgzstring=xfz 482 | extract 483 | 484 | cd NPB3.3.1/NPB3.3-OMP/ 485 | echo "Building NPB" 486 | 487 | # Use the provided makefile definitions 488 | cp config/NAS.samples/make.def.gcc_x86 config/make.def 489 | 490 | # Define which tests to build 491 | echo "ft A" >> config/suite.def 492 | #echo "mg A" >> config/suite.def 493 | #echo "sp A" >> config/suite.def 494 | #echo "lu A" >> config/suite.def 495 | echo "bt A" >> config/suite.def 496 | #echo "is A" >> config/suite.def 497 | #echo "ep A" >> config/suite.def 498 | #echo "cg A" >> config/suite.def 499 | #echo "ua A" >> config/suite.def 500 | #echo "dc A" >> config/suite.def 501 | 502 | make suite 503 | 504 | export OMP_NUM_THREADS=$cores 505 | 506 | echo "Running NPB tests" 507 | bin/bt.A.x 508 | bin/ft.A.x 509 | 510 | cd $benchdir 511 | rm -rf NPB* 512 | } 513 | 514 | 515 | # NAMD Benchmark http://www.ks.uiuc.edu/Research/namd/performance.html 516 | NAMD() 517 | { 518 | echo "Building NAMD" 519 | cd $benchdir 520 | 521 | appbase=NAMD_2.9_Linux-x86_64-multicore 522 | apptgz=NAMD_2.9_Linux-x86_64-multicore.tar.gz 523 | tgzstring=xfz 524 | appbin=$appbase/namd2 525 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 526 | extract 527 | 528 | appbase=apoa1 529 | apptgz=apoa1.tar.gz 530 | tgzstring=xfz 531 | appbin=$appbase/apoa1.pdb 532 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 533 | extract 534 | 535 | echo "Using" $threads "threads" 536 | echo "Running NAMD benchmark... (will take a while)" 537 | 538 | cd NAMD_2.9_Linux-x86_64-multicore 539 | timeperstep=$(./namd2 +p$threads +setcpuaffinity ../apoa1/apoa1.namd | grep "Benchmark time" | tail -1 | cut -d" " -f6) 540 | 541 | echo "Time per step" $timeperstep 542 | 543 | cd $benchdir 544 | rm -rf NAMD* apoa1* 545 | 546 | } 547 | 548 | # p7zip 549 | p7zip() 550 | { 551 | cd $benchdir 552 | 553 | appbase=p7zip_9.20.1 554 | apptgz=p7zip_9.20.1_src_all.tar.bz2 555 | tgzstring=xfj 556 | appbin=p7zip_9.20.1/bin/7za 557 | appdlpath=http://linuxbench.servethehome.com/benchfiles/$apptgz 558 | extract 559 | 560 | echo "Building p7zip" 561 | cd $appbase 562 | make 2>&1 >> /dev/null 563 | 564 | echo "Starting 7zip benchmark, this will take a while" 565 | bin/7za b >> output.txt 566 | 567 | compressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f4) 568 | decompressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f7) 569 | 570 | echo "Compress speed (MIPS):" $compressmips 571 | echo "Decompress speed (MIPS):" $decompressmips 572 | 573 | cd $benchdir 574 | rm -rf p7zip* 575 | 576 | 577 | } 578 | 579 | runBenches() 580 | { 581 | #Individual modules run below...comment them out to prevent them from running. 582 | #echo ${iterations:=1} passes 583 | # while [ $iterations -gt 0 ] ; do 584 | echo "hardinfo" 585 | time hardi 586 | echo "ubench" 587 | time ubench 588 | echo "cray" 589 | time cray 590 | echo "stream" 591 | time stream 592 | echo "OSSL" 593 | time OSSL 594 | echo "sysbench" 595 | time sysb 596 | echo "redis" 597 | time red 598 | echo "NPB" 599 | time NPB 600 | echo "NAMD" 601 | time NAMD 602 | echo "p7zip" 603 | time p7zip 604 | # let iterations-=1 605 | # done 606 | 607 | } 608 | 609 | 610 | 611 | # Runtime This is where everything is actually run from and called... 612 | # 613 | # This is where a menu would go for runtime options... 614 | # 615 | 616 | main() 617 | { 618 | rootcheck 619 | 620 | while getopts "hVRpe:" arg; do 621 | 622 | case $arg in 623 | h) 624 | usage 625 | exit 1 626 | ;; 627 | V) 628 | version 629 | exit 1 630 | ;; 631 | p) 632 | isprivate="Private Result" 633 | ;; 634 | e) 635 | email="Send Linux-Bench result to: $OPTARG" 636 | ;; 637 | \?) 638 | usage 639 | exit 1 640 | ;; 641 | esac 642 | done 643 | 644 | echo "setup" 645 | setup 646 | echo "version" 647 | version 648 | echo "whichdistro" 649 | whichdistro 650 | echo "dlDep" 651 | dlDependancies 652 | echo "benchlog" 653 | benchlog 654 | echo "derpinfo" 655 | sysinfo exiting on sysinfo... 656 | sysinfo 657 | echo "proc_define" 658 | proc_define 659 | echo "run benches" 660 | runBenches 661 | echo "done" 662 | } 663 | 664 | push_data() { 665 | ref=$(date +%S%d$i%s) 666 | echo "ref_link: $ref" 667 | echo "See your results online at: http://beta.linux-bench.com/display/$ref" 668 | mkdir tmpbench && cp $log tmpbench/. 669 | sleep 1s 670 | curl -F file="@./tmpbench/$log" http://parser.linux-bench.com:3000/java-process/uploader -H "Connection: close" 671 | curl --form file="@./tmpbench/$log" --form press=Upload http://beta.linux-bench.com/upload_file/ --trace-ascii dumpfile 672 | rm -rf ./tmpbench/ 673 | } 674 | 675 | # Execute everything in the script 676 | main 677 | push_data 678 | -------------------------------------------------------------------------------- /linux-bench-minimal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Linux-Bench CPU Benchmark Script 4 | # (C) 2013-2017 ServeTheHome.com and ServeThe.biz 5 | # 6 | # Linux-Bench - A System benchmark and comparison tool created by the STH community. 7 | # 8 | # Linux-Bench is a sscript that runs hardinfo, Unixbench 5.1.3, c-ray 1.1, STREAM, OpenSSL, sysbench (CPU), 9 | # crafty, redis, NPB, NAMD, and 7-zip benchmarks without manual intervention. 10 | # 11 | # Linux-Bench must be run as root or using a su prompt to automate download and installation of benchmarks 12 | # 13 | # For more information go: 14 | # http://linux-bench.com 15 | # 16 | # Authors: Patrick Kennedy, Charles Nguyen (Chuckleb), Patriot, nitrobass24, mir, Frank DiDonato (LOGiCELL, Inc.) 17 | # 18 | # Latest development versions are available on the GitHub site: https://github.com/STH-Dev/linux-bench/ 19 | # 20 | # If you find bugs, verify you are on the latest version and then post in: 21 | # https://forums.servethehome.com/index.php?forums/linux-bench/ 22 | # 23 | # To view your results, check the reference ID at the end of the log file generated. You can copy and paste 24 | # the ID number here: http://linux-bench.com/parser.html and see parsed results. 25 | ################################################################################################################################ 26 | 27 | #Current Version 28 | rev='12.20' 29 | 30 | version() 31 | { 32 | cat << EOF 33 | ############################################################## 34 | # (c) 2013-2017 ServeTheHome.com and ServeThe.biz 35 | # 36 | # Linux-Bench $rev 37 | # - Linux-Bench the STH Benchmark Suite 38 | ############################################################### 39 | 40 | EOF 41 | } 42 | 43 | 44 | usage() 45 | { 46 | cat << EOF 47 | 48 | usage: $0 49 | 50 | This is the STH benchmark suite. 51 | 52 | ARGS: 53 | ARG1 - none required for now 54 | ARG2 - none required for now 55 | ARG3 - none required for now 56 | 57 | OPTIONAL ARGS: 58 | ARG -- script_option_1 script_option-2 59 | 60 | OPTIONS: 61 | -h help (usage info) 62 | -V Version of Linux-Bench 63 | -p Private Result, results will not be in the public database 64 | -e Email results, a perfect pairing with private results. 65 | use -e email@email.net 66 | 67 | 68 | ENVIRONMENT VARIABLES: 69 | 70 | VIRTUAL = If unset, value is FALSE. Set to TRUE if running virtualized (automatically set for Docker) 71 | 72 | EOF 73 | } 74 | 75 | 76 | # Verify if the script is executed with Root Privileges # 77 | rootcheck() 78 | { 79 | if [[ $EUID -ne 0 ]]; then 80 | echo "This script must be run as root" 81 | echo "Ex. "sudo ./linux-bench.sh"" 82 | exit 1 83 | fi 84 | } 85 | 86 | 87 | #Set Functions 88 | setup() 89 | { 90 | benchdir=`pwd` 91 | NEED_PTS=1 92 | 93 | date_str="+%Y_%m%d_%H%M%S" 94 | full_date=`date $date_str` 95 | host=$(hostname) 96 | log="linux-bench"$rev"_"$host"_"$full_date.log 97 | if [ -f /.dockerinit ] ; then 98 | log=/data/"linux-bench"$rev"_"$host"_"$full_date.log 99 | fi 100 | 101 | if [ -n "$isprivate" ]; then 102 | echo $isprivate 103 | fi 104 | 105 | if [ -n "$email" ]; then 106 | echo $email 107 | fi 108 | 109 | #outdir=$host"_"$full_date 110 | #mkdir $outdir 111 | } 112 | 113 | 114 | # Update and install required packages (Debian) 115 | Update_Install_Debian() 116 | { 117 | apt-get update 118 | apt-get -y install build-essential libx11-dev libglu-dev hardinfo sysbench unzip expect php7.0-curl php7.0-common php7.0-cli php7.0-gd libfpdi-php gfortran curl 119 | mkdir -p /usr/tmp/ 120 | rm /etc/apt/sources.list.d/linuxbench.list 121 | } 122 | 123 | 124 | # Update and install required packages (CentOS/RHEL) 125 | Update_Install_RHEL() 126 | { 127 | rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 128 | rpm -Uhv http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 129 | yum -y groupinstall "Development Tools" && yum -y install wget sysbench unzip libX11 perl-Time-HiRes mesa-libGLU hardinfo expect php-common glibc.i686 gfortran curl 130 | } 131 | 132 | 133 | # Detects which OS and if it is Linux then it will detect which Linux Distribution. 134 | whichdistro() 135 | { 136 | OS=`uname -s` 137 | REV=`uname -r` 138 | MACH=`uname -m` 139 | 140 | if [ "${OS}" = "SunOS" ] ; then 141 | OS=Solaris 142 | DIST=Solaris 143 | ARCH=`uname -p` 144 | OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" 145 | elif [ "${OS}" = "AIX" ] ; then 146 | DIST=AIX 147 | OSSTR="${OS} `oslevel` (`oslevel -r`)" 148 | 149 | elif [ "${OS}" = "Linux" ] ; then 150 | KERNEL=`uname -r` 151 | 152 | if [ -f /etc/redhat-release ] ; then 153 | DIST='RedHat' 154 | PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` 155 | REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` 156 | 157 | elif [ -f /etc/centos-release ] ; then 158 | DIST='CentOS' 159 | PSUEDONAME=`cat /etc/centos-release | sed s/.*\(// | sed s/\)//` 160 | REV=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//` 161 | 162 | elif [ -f /etc/SuSE-release ] ; then 163 | DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` 164 | REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //` 165 | 166 | elif [ -f /etc/mandrake-release ] ; then 167 | DIST='Mandrake' 168 | PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` 169 | REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` 170 | 171 | elif [ -f /etc/debian_version ] ; then 172 | DIST="Debian" 173 | PSUEDONAME=`cat /etc/debian_version` 174 | REV="" 175 | if [ `grep DISTRIB_ID= /etc/lsb-release | cut -d"=" -f2` = "Ubuntu" ] ; then 176 | DIST="Ubuntu" 177 | UBUNTU_RELEASE=`lsb_release -sc` 178 | REPO1="deb http://us.archive.ubuntu.com/ubuntu/ " 179 | REPO1END=" universe" 180 | echo $REPO1 $UBUNTU_RELEASE $REPO1END > /etc/apt/sources.list.d/linuxbench.list 181 | fi 182 | 183 | elif [ -f /etc/UnitedLinux-release ] ; then 184 | DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" 185 | 186 | else 187 | DIST='Not detected' 188 | fi 189 | 190 | OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})" 191 | fi 192 | } 193 | 194 | 195 | # Update and install required packages 196 | dlDependancies() 197 | { 198 | if [ -f /.dockerinit ] ; then 199 | echo "In a Docker container, no updates run." 200 | VIRTUAL="TRUE" 201 | elif [ "${DIST}" = "CentOS" ] ; then 202 | Update_Install_RHEL 203 | elif [ "${DIST}" = "RedHat" ] ; then 204 | Update_Install_RHEL 205 | elif [ "${DIST}" = "Debian" ] || [ "${DIST}" = "Ubuntu" ] ; then 206 | Update_Install_Debian 207 | fi 208 | } 209 | 210 | 211 | # Display script output and append to log 212 | benchlog() 213 | { 214 | exec > >(tee --append $log) 215 | echo $ref >> $log 216 | exec 2>&1 217 | echo ${OSSTR} 218 | } 219 | 220 | 221 | extract() 222 | { 223 | if [ -e ./$appbin ] ; then 224 | echo "$apptgz already installed" 225 | elif [ -e ./$apptgz ] ; then 226 | tar $tgzstring $apptgz 227 | else 228 | wget $appdlpath 229 | tar $tgzstring $apptgz 230 | fi 231 | } 232 | 233 | 234 | #System information and log capture. 235 | sysinfo() 236 | { 237 | eval "strings `which lscpu`" | grep -q version ; 238 | if [ $? = 0 ] ; then 239 | lscpu 240 | lscpu -V 241 | lscpu -e 242 | else 243 | lscpu; 244 | fi 245 | : ${VIRTUAL:=FALSE} 246 | echo "VIRTUAL="$VIRTUAL 247 | 248 | 249 | # Check to see if the CPU is an Intel/AMD or ARM 250 | # This is a simple check for now. 251 | 252 | cpu_check=$(grep 'CPU architecture' /proc/cpuinfo) 253 | if [ $? -ne 0 ] ; then 254 | CPU=x86 255 | else 256 | CPU=ARM; 257 | fi 258 | 259 | echo "CPU="$CPU 260 | 261 | echo "Linux-Bench Version="$rev 262 | } 263 | 264 | proc_define() 265 | { 266 | # Physical sockets 267 | sockets=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 268 | 269 | # Physical Cores 270 | if [[ $CPU == "x86" ]] ; then 271 | procs=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 272 | pcores=$(grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2) 273 | cores=$((procs*pcores)) 274 | elif [[ $CPU == "ARM" ]] ; then 275 | cores=$(grep "processor" /proc/cpuinfo | wc -l) 276 | else 277 | echo "Unknown CPU" 278 | fi 279 | 280 | # Virtual Cores (include threads) 281 | vcores=$(grep "processor" /proc/cpuinfo | wc -l) 282 | threads=$vcores 283 | nproc=$vcores 284 | 285 | } 286 | 287 | 288 | # HardInfo 289 | hardi() 290 | { 291 | cd $benchdir 292 | echo "Running HardInfo test" 293 | hardinfo --generate-report --report-format text 294 | } 295 | 296 | # UnixBench 5.1.3 297 | ubench() 298 | { 299 | cd $benchdir 300 | echo "Building UnixBench" 301 | wget -N http://files.linux-bench.com/lb/UnixBench5.1.3.tgz 302 | wget -N http://files.linux-bench.com/lb/fix-limitation.patch 303 | tar -zxf UnixBench5.1.3.tgz 304 | 305 | cd UnixBench 306 | mv ../fix-limitation.patch . 307 | make -j$(nproc) 308 | patch Run fix-limitation.patch 309 | echo "Running UnixBench" 310 | ./Run dhry2reg whetstone-double 311 | cd $benchdir 312 | rm -rf UnixBench* fix-limitation.patch 313 | 314 | } 315 | 316 | # C-Ray 1.1 317 | cray() 318 | { 319 | cd $benchdir 320 | 321 | appbase=c-ray-1.1 322 | apptgz=c-ray-1.1.gz 323 | tgzstring=xfz 324 | appbin=$appbase/c-ray-mt 325 | appdlpath=http://files.linux-bench.com/lb/$apptgz 326 | extract 327 | 328 | echo "Running C-Ray test" 329 | cd c-ray-1.1 && make 330 | echo "c-ray Easy Test" 331 | cat scene | ./c-ray-mt -t $threads -s 7500x3500 > foo.ppm 332 | echo "c-ray Medium Test" 333 | cat sphfract | ./c-ray-mt -t $threads -s 1920x1200 -r 8 > foo.ppm 334 | echo "c-ray Hard Test" 335 | cat sphfract | ./c-ray-mt -t $threads -s 3840x2160 -r 8 > foo.ppm 336 | cd $benchdir 337 | rm -rf $appbase* 338 | 339 | } 340 | 341 | # STREAM by Dr. John D. McCalpin 342 | stream() 343 | { 344 | cd $benchdir 345 | echo "Building STREAM" 346 | 347 | if [ -e stream.c ] ; then 348 | echo "Stream downloaded" 349 | else 350 | wget -N http://www.cs.virginia.edu/stream/FTP/Code/stream.c 351 | fi 352 | 353 | gcc stream.c -O3 -march=native -fopenmp -o stream-me 354 | 355 | export OMP_NUM_THREADS=$cores 356 | export GOMP_CPU_AFFINITY=0-$((cores-1)) 357 | echo $GOMP_CPU_AFFINITY 358 | 359 | echo "Running STREAM test" 360 | ./stream-me 361 | 362 | cd $benchdir 363 | rm -rf stream-me stream.c 364 | } 365 | 366 | # OpenSSL 367 | OSSL() 368 | { 369 | cd $benchdir 370 | 371 | appbase=openssl-1.0.1g 372 | apptgz=openssl-1.0.1g.tar.gz 373 | tgzstring=xfz 374 | appbin=$appbase/apps/openssl 375 | appdlpath=http://www.openssl.org/source/$apptgz 376 | extract 377 | 378 | cd openssl-1.0.1g/ 379 | echo "Building OpenSSL" 380 | ./config no-zlib 2>&1 >> /dev/null 381 | make 2>&1 >> /dev/null 382 | echo "Running OpenSSL test" 383 | ./apps/openssl speed rsa4096 -multi $nproc 384 | 385 | cd $benchdir 386 | rm -rf openssl* 387 | 388 | 389 | } 390 | 391 | crafty() 392 | { 393 | cd $benchdir 394 | wget -N http://www.craftychess.com/crafty-23.4.zip 395 | unzip -o crafty-23.4.zip 396 | cd crafty-23.4/ 397 | export target=LINUX 398 | export CFLAGS="-Wall -pipe -O3 -fomit-frame-pointer $CFLAGS" 399 | export CXFLAGS="-Wall -pipe -O3 -fomit-frame-pointer" 400 | export LDFLAGS="$LDFLAGS -lstdc++" 401 | make crafty-make 402 | chmod +x crafty 403 | ./crafty bench end 404 | 405 | cd $benchdir 406 | rm -rf crafty* 407 | 408 | } 409 | 410 | 411 | 412 | # sysbench CPU test prime 413 | sysb() 414 | { 415 | cd $benchdir 416 | echo "Running sysbench CPU Single Thread" 417 | sysbench --test=cpu --cpu-max-prime=30000 run 418 | echo "Running sysbench CPU Multi-Threaded" 419 | sysbench --num-threads=$nproc --test=cpu --cpu-max-prime=300000 run 420 | } 421 | 422 | 423 | # redis Benchmark based on feedback. Next step is to add memchached as seen here: http://oldblog.antirez.com/post/redis-memcached-benchmark.html 424 | #red() 425 | #{ 426 | # cd $benchdir 427 | # echo "Building Redis" 428 | # 429 | # wget http://download.redis.io/redis-stable.tar.gz 430 | # tar xzf redis-stable.tar.gz && cd redis-stable && make install 431 | # cp utils/redis_init_script /etc/init.d/redis_6379 432 | # mkdir -p /var/redis/6379 433 | # wget http://files.linux-bench.com/lb/6379.conf 434 | ## mkdir -p /etc/redis 435 | # cp ./6379.conf /etc/redis 436 | # 437 | # service redis_6379 start 438 | # 439 | # # Original redis benchmark set/ get test 440 | # 441 | # echo "Running Redis test" 442 | # redis-benchmark -n 1000000 -t set,get -P 32 -q -c 200 443 | # 444 | # BIN=redis-benchmark 445 | # 446 | # payload=32 447 | # iterations=10000 448 | # keyspace=100000 449 | # 450 | # for clients in 1 5 10 25 50 75 100 451 | # do 452 | # SPEED=0 453 | # for dummy in 0 1 2 454 | # do 455 | # S=$($BIN -n $iterations -r $keyspace -d $payload -c $clients | grep 'per second' | tail -1 | awk '{print $1}') 456 | # VALUE=$(echo $S | awk '{printf "%.0f",$1}') 457 | # if [ $(($VALUE > $SPEED)) != 0 ] 458 | # then 459 | # SPEED=$VALUE 460 | # fi 461 | # done 462 | # echo "$clients $SPEED" 463 | # done 464 | # 465 | # redis-cli shutdown 466 | # 467 | # cd $benchdir 468 | # rm -rf redis* /etc/redis /var/redis* /usr/local/bin/redis-* /etc/init.d/redis_* 469 | # 470 | #} 471 | 472 | 473 | # NPB Benchmarks 474 | NPB() 475 | { 476 | cd $benchdir 477 | 478 | apptgz=NPB3.3.1.tar.gz 479 | appbin=NPB3.3.1/NPB3.3-OMP 480 | appdlpath=http://files.linux-bench.com/lb/$apptgz 481 | tgzstring=xfz 482 | extract 483 | 484 | cd NPB3.3.1/NPB3.3-OMP/ 485 | echo "Building NPB" 486 | 487 | # Use the provided makefile definitions 488 | cp config/NAS.samples/make.def.gcc_x86 config/make.def 489 | 490 | # Define which tests to build 491 | echo "ft A" >> config/suite.def 492 | #echo "mg A" >> config/suite.def 493 | #echo "sp A" >> config/suite.def 494 | #echo "lu A" >> config/suite.def 495 | echo "bt A" >> config/suite.def 496 | #echo "is A" >> config/suite.def 497 | #echo "ep A" >> config/suite.def 498 | #echo "cg A" >> config/suite.def 499 | #echo "ua A" >> config/suite.def 500 | #echo "dc A" >> config/suite.def 501 | 502 | make suite 503 | 504 | export OMP_NUM_THREADS=$cores 505 | 506 | echo "Running NPB tests" 507 | bin/bt.A.x 508 | bin/ft.A.x 509 | 510 | cd $benchdir 511 | rm -rf NPB* 512 | } 513 | 514 | 515 | # NAMD Benchmark http://www.ks.uiuc.edu/Research/namd/performance.html 516 | NAMD() 517 | { 518 | echo "Building NAMD" 519 | cd $benchdir 520 | 521 | appbase=NAMD_2.9_Linux-x86_64-multicore 522 | apptgz=NAMD_2.9_Linux-x86_64-multicore.tar.gz 523 | tgzstring=xfz 524 | appbin=$appbase/namd2 525 | appdlpath=http://files.linux-bench.com/lb/$apptgz 526 | extract 527 | 528 | appbase=apoa1 529 | apptgz=apoa1.tar.gz 530 | tgzstring=xfz 531 | appbin=$appbase/apoa1.pdb 532 | appdlpath=http://files.linux-bench.com/lb/$apptgz 533 | extract 534 | 535 | echo "Using" $threads "threads" 536 | echo "Running NAMD benchmark... (will take a while)" 537 | 538 | cd NAMD_2.9_Linux-x86_64-multicore 539 | timeperstep=$(./namd2 +p$threads +setcpuaffinity ../apoa1/apoa1.namd | grep "Benchmark time" | tail -1 | cut -d" " -f6) 540 | 541 | echo "Time per step" $timeperstep 542 | 543 | cd $benchdir 544 | rm -rf NAMD* apoa1* 545 | 546 | } 547 | 548 | # p7zip 549 | p7zip() 550 | { 551 | cd $benchdir 552 | 553 | appbase=p7zip_9.20.1 554 | apptgz=p7zip_9.20.1_src_all.tar.bz2 555 | tgzstring=xfj 556 | appbin=p7zip_9.20.1/bin/7za 557 | appdlpath=http://files.linux-bench.com/lb/$apptgz 558 | extract 559 | 560 | echo "Building p7zip" 561 | cd $appbase 562 | make 2>&1 >> /dev/null 563 | 564 | echo "Starting 7zip benchmark, this will take a while" 565 | bin/7za b >> output.txt 566 | 567 | compressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f4) 568 | decompressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f7) 569 | 570 | echo "Compress speed (MIPS):" $compressmips 571 | echo "Decompress speed (MIPS):" $decompressmips 572 | 573 | cd $benchdir 574 | rm -rf p7zip* 575 | 576 | 577 | } 578 | 579 | runBenches() 580 | { 581 | #Individual modules run below...comment them out to prevent them from running. 582 | #echo ${iterations:=1} passes 583 | # while [ $iterations -gt 0 ] ; do 584 | echo "hardinfo" 585 | time hardi 586 | echo "ubench" 587 | time ubench 588 | echo "cray" 589 | time cray 590 | echo "stream" 591 | time stream 592 | echo "OSSL" 593 | time OSSL 594 | echo "sysbench" 595 | time sysb 596 | echo "redis" 597 | time red 598 | echo "NPB" 599 | time NPB 600 | echo "NAMD" 601 | time NAMD 602 | echo "p7zip" 603 | time p7zip 604 | # let iterations-=1 605 | # done 606 | 607 | } 608 | 609 | 610 | 611 | # Runtime This is where everything is actually run from and called... 612 | # 613 | # This is where a menu would go for runtime options... 614 | # 615 | 616 | main() 617 | { 618 | rootcheck 619 | 620 | while getopts "hVRpe:" arg; do 621 | 622 | case $arg in 623 | h) 624 | usage 625 | exit 1 626 | ;; 627 | V) 628 | version 629 | exit 1 630 | ;; 631 | p) 632 | isprivate="Private Result" 633 | ;; 634 | e) 635 | email="Send Linux-Bench result to: $OPTARG" 636 | ;; 637 | \?) 638 | usage 639 | exit 1 640 | ;; 641 | esac 642 | done 643 | 644 | echo "setup" 645 | setup 646 | echo "version" 647 | version 648 | echo "whichdistro" 649 | whichdistro 650 | echo "dlDep" 651 | dlDependancies 652 | echo "benchlog" 653 | benchlog 654 | echo "derpinfo" 655 | sysinfo exiting on sysinfo... 656 | sysinfo 657 | echo "proc_define" 658 | proc_define 659 | echo "run benches" 660 | runBenches 661 | echo "done" 662 | } 663 | 664 | push_data() { 665 | ref=$(date +%S%d$i%s) 666 | echo "ref_link: $ref" 667 | echo "See your results online at: http://linux-bench.com/display/$ref" 668 | mkdir tmpbench && cp $log tmpbench/. 669 | sleep 1s 670 | # curl -F file="@./tmpbench/$log" http://parser.linux-bench.com:3000/java-process/uploader -H "Connection: close" 671 | curl --form file="@./tmpbench/$log" --form press=Upload http://beta.linux-bench.com/upload_file/ --trace-ascii dumpfile 672 | 673 | #Adding new script targets 674 | curl --form file="@./tmpbench/$log" --form press=Upload http://linux-bench.com/upload_file/ --trace-ascii dumpfile 675 | # curl -F file="@./tmpbench/$log" http://linux-bench.com:3000/java-process/uploader -H "Connection: close" 676 | rm -rf ./tmpbench/ 677 | echo "ref_link: $ref" 678 | } 679 | 680 | # Execute everything in the script 681 | main 682 | push_data 683 | -------------------------------------------------------------------------------- /linux-bench.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Linux-Bench CPU Benchmark Script 4 | # (C) 2013-2017 ServeTheHome.com and ServeThe.biz 5 | # 6 | # Linux-Bench - A System benchmark and comparison tool created by the STH community. 7 | # 8 | # Linux-Bench is a sscript that runs hardinfo, Unixbench 5.1.3, c-ray 1.1, STREAM, OpenSSL, sysbench (CPU), 9 | # crafty, redis, NPB, NAMD, and 7-zip benchmarks without manual intervention. 10 | # 11 | # Linux-Bench must be run as root or using a su prompt to automate download and installation of benchmarks 12 | # 13 | # For more information go: 14 | # http://linux-bench.com 15 | # 16 | # Authors: Patrick Kennedy, Charles Nguyen (Chuckleb), Patriot, nitrobass24, mir, Frank DiDonato (LOGiCELL, Inc.) 17 | # 18 | # Latest development versions are available on the GitHub site: https://github.com/STH-Dev/linux-bench/ 19 | # 20 | # If you find bugs, verify you are on the latest version and then post in: 21 | # https://forums.servethehome.com/index.php?forums/linux-bench/ 22 | # 23 | # To view your results, check the reference ID at the end of the log file generated. You can copy and paste 24 | # the ID number here: http://linux-bench.com/parser.html and see parsed results. 25 | ################################################################################################################################ 26 | 27 | #Current Version 28 | rev='12.19' 29 | 30 | version() 31 | { 32 | cat << EOF 33 | ############################################################## 34 | # (c) 2013-2017 ServeTheHome.com and ServeThe.biz 35 | # 36 | # Linux-Bench $rev 37 | # - Linux-Bench the STH Benchmark Suite 38 | ############################################################### 39 | 40 | EOF 41 | } 42 | 43 | 44 | usage() 45 | { 46 | cat << EOF 47 | 48 | usage: $0 49 | 50 | This is the STH benchmark suite. 51 | 52 | ARGS: 53 | ARG1 - none required for now 54 | ARG2 - none required for now 55 | ARG3 - none required for now 56 | 57 | OPTIONAL ARGS: 58 | ARG -- script_option_1 script_option-2 59 | 60 | OPTIONS: 61 | -h help (usage info) 62 | -V Version of Linux-Bench 63 | -p Private Result, results will not be in the public database 64 | -e Email results, a perfect pairing with private results. 65 | use -e email@email.net 66 | 67 | 68 | ENVIRONMENT VARIABLES: 69 | 70 | VIRTUAL = If unset, value is FALSE. Set to TRUE if running virtualized (automatically set for Docker) 71 | 72 | EOF 73 | } 74 | 75 | 76 | # Verify if the script is executed with Root Privileges # 77 | rootcheck() 78 | { 79 | if [[ $EUID -ne 0 ]]; then 80 | echo "This script must be run as root" 81 | echo "Ex. "sudo ./linux-bench.sh"" 82 | exit 1 83 | fi 84 | } 85 | 86 | 87 | #Set Functions 88 | setup() 89 | { 90 | benchdir=`pwd` 91 | NEED_PTS=1 92 | 93 | date_str="+%Y_%m%d_%H%M%S" 94 | full_date=`date $date_str` 95 | host=$(hostname) 96 | log="linux-bench"$rev"_"$host"_"$full_date.log 97 | if [ -f /.dockerinit ] ; then 98 | log=/data/"linux-bench"$rev"_"$host"_"$full_date.log 99 | fi 100 | 101 | if [ -n "$isprivate" ]; then 102 | echo $isprivate 103 | fi 104 | 105 | if [ -n "$email" ]; then 106 | echo $email 107 | fi 108 | 109 | #outdir=$host"_"$full_date 110 | #mkdir $outdir 111 | } 112 | 113 | 114 | # Update and install required packages (Debian) 115 | Update_Install_Debian() 116 | { 117 | apt-get update 118 | apt-get -y install build-essential libx11-dev libglu-dev hardinfo sysbench unzip expect php7.0-curl php7.0-common php7.0-cli php7.0-gd libfpdi-php gfortran curl 119 | mkdir -p /usr/tmp/ 120 | rm /etc/apt/sources.list.d/linuxbench.list 121 | } 122 | 123 | 124 | # Update and install required packages (CentOS/RHEL) 125 | Update_Install_RHEL() 126 | { 127 | rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 128 | rpm -Uhv http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 129 | yum -y groupinstall "Development Tools" && yum -y install wget sysbench unzip libX11 perl-Time-HiRes mesa-libGLU hardinfo expect php-common glibc.i686 gfortran curl 130 | } 131 | 132 | 133 | # Detects which OS and if it is Linux then it will detect which Linux Distribution. 134 | whichdistro() 135 | { 136 | OS=`uname -s` 137 | REV=`uname -r` 138 | MACH=`uname -m` 139 | 140 | if [ "${OS}" = "SunOS" ] ; then 141 | OS=Solaris 142 | DIST=Solaris 143 | ARCH=`uname -p` 144 | OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" 145 | elif [ "${OS}" = "AIX" ] ; then 146 | DIST=AIX 147 | OSSTR="${OS} `oslevel` (`oslevel -r`)" 148 | 149 | elif [ "${OS}" = "Linux" ] ; then 150 | KERNEL=`uname -r` 151 | 152 | if [ -f /etc/redhat-release ] ; then 153 | DIST='RedHat' 154 | PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` 155 | REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` 156 | 157 | elif [ -f /etc/centos-release ] ; then 158 | DIST='CentOS' 159 | PSUEDONAME=`cat /etc/centos-release | sed s/.*\(// | sed s/\)//` 160 | REV=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//` 161 | 162 | elif [ -f /etc/SuSE-release ] ; then 163 | DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` 164 | REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //` 165 | 166 | elif [ -f /etc/mandrake-release ] ; then 167 | DIST='Mandrake' 168 | PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` 169 | REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` 170 | 171 | elif [ -f /etc/debian_version ] ; then 172 | DIST="Debian" 173 | PSUEDONAME=`cat /etc/debian_version` 174 | REV="" 175 | if [ `grep DISTRIB_ID= /etc/lsb-release | cut -d"=" -f2` = "Ubuntu" ] ; then 176 | DIST="Ubuntu" 177 | UBUNTU_RELEASE=`lsb_release -sc` 178 | REPO1="deb http://us.archive.ubuntu.com/ubuntu/ " 179 | REPO1END=" universe" 180 | echo $REPO1 $UBUNTU_RELEASE $REPO1END > /etc/apt/sources.list.d/linuxbench.list 181 | fi 182 | 183 | elif [ -f /etc/UnitedLinux-release ] ; then 184 | DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" 185 | 186 | else 187 | DIST='Not detected' 188 | fi 189 | 190 | OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})" 191 | fi 192 | } 193 | 194 | 195 | # Update and install required packages 196 | dlDependancies() 197 | { 198 | if [ -f /.dockerinit ] ; then 199 | echo "In a Docker container, no updates run." 200 | VIRTUAL="TRUE" 201 | elif [ "${DIST}" = "CentOS" ] ; then 202 | Update_Install_RHEL 203 | elif [ "${DIST}" = "RedHat" ] ; then 204 | Update_Install_RHEL 205 | elif [ "${DIST}" = "Debian" ] || [ "${DIST}" = "Ubuntu" ] ; then 206 | Update_Install_Debian 207 | fi 208 | } 209 | 210 | 211 | # Display script output and append to log 212 | benchlog() 213 | { 214 | exec > >(tee --append $log) 215 | echo $ref >> $log 216 | exec 2>&1 217 | echo ${OSSTR} 218 | } 219 | 220 | 221 | extract() 222 | { 223 | if [ -e ./$appbin ] ; then 224 | echo "$apptgz already installed" 225 | elif [ -e ./$apptgz ] ; then 226 | tar $tgzstring $apptgz 227 | else 228 | wget $appdlpath 229 | tar $tgzstring $apptgz 230 | fi 231 | } 232 | 233 | 234 | #System information and log capture. 235 | sysinfo() 236 | { 237 | eval "strings `which lscpu`" | grep -q version ; 238 | if [ $? = 0 ] ; then 239 | lscpu 240 | lscpu -V 241 | lscpu -e 242 | else 243 | lscpu; 244 | fi 245 | : ${VIRTUAL:=FALSE} 246 | echo "VIRTUAL="$VIRTUAL 247 | 248 | 249 | # Check to see if the CPU is an Intel/AMD or ARM 250 | # This is a simple check for now. 251 | 252 | cpu_check=$(grep 'CPU architecture' /proc/cpuinfo) 253 | if [ $? -ne 0 ] ; then 254 | CPU=x86 255 | else 256 | CPU=ARM; 257 | fi 258 | 259 | echo "CPU="$CPU 260 | 261 | echo "Linux-Bench Version="$rev 262 | } 263 | 264 | proc_define() 265 | { 266 | # Physical sockets 267 | sockets=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 268 | 269 | # Physical Cores 270 | if [[ $CPU == "x86" ]] ; then 271 | procs=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 272 | pcores=$(grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2) 273 | cores=$((procs*pcores)) 274 | elif [[ $CPU == "ARM" ]] ; then 275 | cores=$(grep "processor" /proc/cpuinfo | wc -l) 276 | else 277 | echo "Unknown CPU" 278 | fi 279 | 280 | # Virtual Cores (include threads) 281 | vcores=$(grep "processor" /proc/cpuinfo | wc -l) 282 | threads=$vcores 283 | nproc=$vcores 284 | 285 | } 286 | 287 | 288 | # HardInfo 289 | hardi() 290 | { 291 | cd $benchdir 292 | echo "Running HardInfo test" 293 | hardinfo --generate-report --report-format text 294 | } 295 | 296 | # UnixBench 5.1.3 297 | ubench() 298 | { 299 | cd $benchdir 300 | echo "Building UnixBench" 301 | wget -N http://files.linux-bench.com/lb/UnixBench5.1.3.tgz 302 | wget -N http://files.linux-bench.com/lb/fix-limitation.patch 303 | tar -zxf UnixBench5.1.3.tgz 304 | 305 | cd UnixBench 306 | mv ../fix-limitation.patch . 307 | make -j$(nproc) 308 | patch Run fix-limitation.patch 309 | echo "Running UnixBench" 310 | ./Run dhry2reg whetstone-double syscall pipe context1 spawn execl shell1 shell8 shell16 311 | cd $benchdir 312 | rm -rf UnixBench* fix-limitation.patch 313 | 314 | } 315 | 316 | # C-Ray 1.1 317 | cray() 318 | { 319 | cd $benchdir 320 | 321 | appbase=c-ray-1.1 322 | apptgz=c-ray-1.1.gz 323 | tgzstring=xfz 324 | appbin=$appbase/c-ray-mt 325 | appdlpath=http://files.linux-bench.com/lb/$apptgz 326 | extract 327 | 328 | echo "Running C-Ray test" 329 | cd c-ray-1.1 && make 330 | echo "c-ray Easy Test" 331 | cat scene | ./c-ray-mt -t $threads -s 7500x3500 > foo.ppm 332 | echo "c-ray Medium Test" 333 | cat sphfract | ./c-ray-mt -t $threads -s 1920x1200 -r 8 > foo.ppm 334 | echo "c-ray Hard Test" 335 | cat sphfract | ./c-ray-mt -t $threads -s 3840x2160 -r 8 > foo.ppm 336 | cd $benchdir 337 | rm -rf $appbase* 338 | 339 | } 340 | 341 | # STREAM by Dr. John D. McCalpin 342 | stream() 343 | { 344 | cd $benchdir 345 | echo "Building STREAM" 346 | 347 | if [ -e stream.c ] ; then 348 | echo "Stream downloaded" 349 | else 350 | wget -N http://www.cs.virginia.edu/stream/FTP/Code/stream.c 351 | fi 352 | 353 | gcc stream.c -O3 -march=native -fopenmp -o stream-me 354 | 355 | export OMP_NUM_THREADS=$cores 356 | export GOMP_CPU_AFFINITY=0-$((cores-1)) 357 | echo $GOMP_CPU_AFFINITY 358 | 359 | echo "Running STREAM test" 360 | ./stream-me 361 | 362 | cd $benchdir 363 | rm -rf stream-me stream.c 364 | } 365 | 366 | # OpenSSL 367 | OSSL() 368 | { 369 | cd $benchdir 370 | 371 | appbase=openssl-1.0.1g 372 | apptgz=openssl-1.0.1g.tar.gz 373 | tgzstring=xfz 374 | appbin=$appbase/apps/openssl 375 | appdlpath=http://www.openssl.org/source/$apptgz 376 | extract 377 | 378 | cd openssl-1.0.1g/ 379 | echo "Building OpenSSL" 380 | ./config no-zlib 2>&1 >> /dev/null 381 | make 2>&1 >> /dev/null 382 | echo "Running OpenSSL test" 383 | ./apps/openssl speed rsa4096 -multi $nproc 384 | 385 | cd $benchdir 386 | rm -rf openssl* 387 | 388 | 389 | } 390 | 391 | crafty() 392 | { 393 | cd $benchdir 394 | wget -N http://www.craftychess.com/crafty-23.4.zip 395 | unzip -o crafty-23.4.zip 396 | cd crafty-23.4/ 397 | export target=LINUX 398 | export CFLAGS="-Wall -pipe -O3 -fomit-frame-pointer $CFLAGS" 399 | export CXFLAGS="-Wall -pipe -O3 -fomit-frame-pointer" 400 | export LDFLAGS="$LDFLAGS -lstdc++" 401 | make crafty-make 402 | chmod +x crafty 403 | ./crafty bench end 404 | 405 | cd $benchdir 406 | rm -rf crafty* 407 | 408 | } 409 | 410 | 411 | 412 | # sysbench CPU test prime 413 | sysb() 414 | { 415 | cd $benchdir 416 | echo "Running sysbench CPU Single Thread" 417 | sysbench --test=cpu --cpu-max-prime=30000 run 418 | echo "Running sysbench CPU Multi-Threaded" 419 | sysbench --num-threads=$nproc --test=cpu --cpu-max-prime=300000 run 420 | } 421 | 422 | 423 | # redis Benchmark based on feedback. Next step is to add memchached as seen here: http://oldblog.antirez.com/post/redis-memcached-benchmark.html 424 | red() 425 | { 426 | cd $benchdir 427 | echo "Building Redis" 428 | 429 | wget http://download.redis.io/redis-stable.tar.gz 430 | tar xzf redis-stable.tar.gz && cd redis-stable && make install 431 | cp utils/redis_init_script /etc/init.d/redis_6379 432 | mkdir -p /var/redis/6379 433 | wget http://files.linux-bench.com/lb/6379.conf 434 | mkdir -p /etc/redis 435 | cp ./6379.conf /etc/redis 436 | 437 | service redis_6379 start 438 | 439 | # Original redis benchmark set/ get test 440 | 441 | echo "Running Redis test" 442 | redis-benchmark -n 1000000 -t set,get -P 32 -q -c 200 443 | 444 | BIN=redis-benchmark 445 | 446 | payload=32 447 | iterations=10000 448 | keyspace=100000 449 | 450 | for clients in 1 5 10 25 50 75 100 451 | do 452 | SPEED=0 453 | for dummy in 0 1 2 454 | do 455 | S=$($BIN -n $iterations -r $keyspace -d $payload -c $clients | grep 'per second' | tail -1 | awk '{print $1}') 456 | VALUE=$(echo $S | awk '{printf "%.0f",$1}') 457 | if [ $(($VALUE > $SPEED)) != 0 ] 458 | then 459 | SPEED=$VALUE 460 | fi 461 | done 462 | echo "$clients $SPEED" 463 | done 464 | 465 | redis-cli shutdown 466 | 467 | cd $benchdir 468 | rm -rf redis* /etc/redis /var/redis* /usr/local/bin/redis-* /etc/init.d/redis_* 469 | 470 | } 471 | 472 | 473 | # NPB Benchmarks 474 | NPB() 475 | { 476 | cd $benchdir 477 | 478 | apptgz=NPB3.3.1.tar.gz 479 | appbin=NPB3.3.1/NPB3.3-OMP 480 | appdlpath=http://files.linux-bench.com/lb/$apptgz 481 | tgzstring=xfz 482 | extract 483 | 484 | cd NPB3.3.1/NPB3.3-OMP/ 485 | echo "Building NPB" 486 | 487 | # Use the provided makefile definitions 488 | cp config/NAS.samples/make.def.gcc_x86 config/make.def 489 | 490 | # Define which tests to build 491 | echo "ft A" >> config/suite.def 492 | #echo "mg A" >> config/suite.def 493 | #echo "sp A" >> config/suite.def 494 | #echo "lu A" >> config/suite.def 495 | echo "bt A" >> config/suite.def 496 | #echo "is A" >> config/suite.def 497 | #echo "ep A" >> config/suite.def 498 | #echo "cg A" >> config/suite.def 499 | #echo "ua A" >> config/suite.def 500 | #echo "dc A" >> config/suite.def 501 | 502 | make suite 503 | 504 | export OMP_NUM_THREADS=$cores 505 | 506 | echo "Running NPB tests" 507 | bin/bt.A.x 508 | bin/ft.A.x 509 | 510 | cd $benchdir 511 | rm -rf NPB* 512 | } 513 | 514 | 515 | # NAMD Benchmark http://www.ks.uiuc.edu/Research/namd/performance.html 516 | NAMD() 517 | { 518 | echo "Building NAMD" 519 | cd $benchdir 520 | 521 | appbase=NAMD_2.9_Linux-x86_64-multicore 522 | apptgz=NAMD_2.9_Linux-x86_64-multicore.tar.gz 523 | tgzstring=xfz 524 | appbin=$appbase/namd2 525 | appdlpath=http://files.linux-bench.com/lb/$apptgz 526 | extract 527 | 528 | appbase=apoa1 529 | apptgz=apoa1.tar.gz 530 | tgzstring=xfz 531 | appbin=$appbase/apoa1.pdb 532 | appdlpath=http://files.linux-bench.com/lb/$apptgz 533 | extract 534 | 535 | echo "Using" $threads "threads" 536 | echo "Running NAMD benchmark... (will take a while)" 537 | 538 | cd NAMD_2.9_Linux-x86_64-multicore 539 | timeperstep=$(./namd2 +p$threads +setcpuaffinity ../apoa1/apoa1.namd | grep "Benchmark time" | tail -1 | cut -d" " -f6) 540 | 541 | echo "Time per step" $timeperstep 542 | 543 | cd $benchdir 544 | rm -rf NAMD* apoa1* 545 | 546 | } 547 | 548 | # p7zip 549 | p7zip() 550 | { 551 | cd $benchdir 552 | 553 | appbase=p7zip_9.20.1 554 | apptgz=p7zip_9.20.1_src_all.tar.bz2 555 | tgzstring=xfj 556 | appbin=p7zip_9.20.1/bin/7za 557 | appdlpath=http://files.linux-bench.com/lb/$apptgz 558 | extract 559 | 560 | echo "Building p7zip" 561 | cd $appbase 562 | make 2>&1 >> /dev/null 563 | 564 | echo "Starting 7zip benchmark, this will take a while" 565 | bin/7za b >> output.txt 566 | 567 | compressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f4) 568 | decompressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f7) 569 | 570 | echo "Compress speed (MIPS):" $compressmips 571 | echo "Decompress speed (MIPS):" $decompressmips 572 | 573 | cd $benchdir 574 | rm -rf p7zip* 575 | 576 | 577 | } 578 | 579 | runBenches() 580 | { 581 | #Individual modules run below...comment them out to prevent them from running. 582 | #echo ${iterations:=1} passes 583 | # while [ $iterations -gt 0 ] ; do 584 | echo "hardinfo" 585 | time hardi 586 | echo "ubench" 587 | time ubench 588 | echo "cray" 589 | time cray 590 | echo "stream" 591 | time stream 592 | echo "OSSL" 593 | time OSSL 594 | echo "sysbench" 595 | time sysb 596 | echo "redis" 597 | time red 598 | echo "NPB" 599 | time NPB 600 | echo "NAMD" 601 | time NAMD 602 | echo "p7zip" 603 | time p7zip 604 | # let iterations-=1 605 | # done 606 | 607 | } 608 | 609 | 610 | 611 | # Runtime This is where everything is actually run from and called... 612 | # 613 | # This is where a menu would go for runtime options... 614 | # 615 | 616 | main() 617 | { 618 | rootcheck 619 | 620 | while getopts "hVRpe:" arg; do 621 | 622 | case $arg in 623 | h) 624 | usage 625 | exit 1 626 | ;; 627 | V) 628 | version 629 | exit 1 630 | ;; 631 | p) 632 | isprivate="Private Result" 633 | ;; 634 | e) 635 | email="Send Linux-Bench result to: $OPTARG" 636 | ;; 637 | \?) 638 | usage 639 | exit 1 640 | ;; 641 | esac 642 | done 643 | 644 | echo "setup" 645 | setup 646 | echo "version" 647 | version 648 | echo "whichdistro" 649 | whichdistro 650 | echo "dlDep" 651 | dlDependancies 652 | echo "benchlog" 653 | benchlog 654 | echo "derpinfo" 655 | sysinfo exiting on sysinfo... 656 | sysinfo 657 | echo "proc_define" 658 | proc_define 659 | echo "run benches" 660 | runBenches 661 | echo "done" 662 | } 663 | 664 | push_data() { 665 | ref=$(date +%S%d$i%s) 666 | echo "ref_link: $ref" 667 | echo "See your results online at: http://linux-bench.com/display/$ref" 668 | mkdir tmpbench && cp $log tmpbench/. 669 | sleep 1s 670 | # curl -F file="@./tmpbench/$log" http://parser.linux-bench.com:3000/java-process/uploader -H "Connection: close" 671 | curl --form file="@./tmpbench/$log" --form press=Upload http://beta.linux-bench.com/upload_file/ --trace-ascii dumpfile 672 | 673 | #Adding new script targets 674 | curl --form file="@./tmpbench/$log" --form press=Upload http://linux-bench.com/upload_file/ --trace-ascii dumpfile 675 | # curl -F file="@./tmpbench/$log" http://linux-bench.com:3000/java-process/uploader -H "Connection: close" 676 | rm -rf ./tmpbench/ 677 | echo "ref_link: $ref" 678 | } 679 | 680 | # Execute everything in the script 681 | main 682 | push_data 683 | -------------------------------------------------------------------------------- /linux-bench-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Linux-Bench - Docker CPU Benchmark Script 4 | # (C) 2013-2015 ServeTheHome.com and ServeThe.biz 5 | # 6 | # Linux-Bench - A System benchmark and comparison tool created by the STH community. 7 | # 8 | # Linux-Bench is a sscript that runs hardinfo, Unixbench 5.1.3, c-ray 1.1, STREAM, OpenSSL, sysbench (CPU), 9 | # crafty, redis, NPB, NAMD, and 7-zip benchmarks without manual intervention. 10 | # 11 | # Linux-Bench must be run as root or using a su prompt to automate download and installation of benchmarks 12 | # 13 | # For more information go: 14 | # http://linux-bench.com 15 | # 16 | # Authors: Patrick Kennedy, Charles Nguyen (Chuckleb), Patriot, nitrobass24, mir, Frank DiDonato (LOGiCELL, Inc.) 17 | # 18 | # Latest development versions are available on the GitHub site: https://github.com/STH-Dev/linux-bench/ 19 | # 20 | # If you find bugs, verify you are on the latest version and then post in: 21 | # https://forums.servethehome.com/index.php?forums/linux-bench/ 22 | # 23 | # To view your results, check the reference ID at the end of the log file generated. You can copy and paste 24 | # the ID number here: http://linux-bench.com/parser.html and see parsed results. 25 | ################################################################################################################################ 26 | 27 | #Current Version 28 | rev='12.17' 29 | 30 | version() 31 | { 32 | cat << EOF 33 | ############################################################## 34 | # (c) 2013-2015 ServeTheHome.com and ServeThe.biz 35 | # 36 | # Linux-Bench $rev 37 | # - Linux-Bench the STH Benchmark Suite 38 | ############################################################### 39 | 40 | EOF 41 | } 42 | 43 | 44 | usage() 45 | { 46 | cat << EOF 47 | 48 | usage: $0 49 | 50 | This is the STH benchmark suite. 51 | 52 | ARGS: 53 | ARG1 - none required for now 54 | ARG2 - none required for now 55 | ARG3 - none required for now 56 | 57 | OPTIONAL ARGS: 58 | ARG -- script_option_1 script_option-2 59 | 60 | OPTIONS: 61 | -h help (usage info) 62 | -V Version of Linux-Bench 63 | -p Private Result, results will not be in the public database 64 | -e Email results, a perfect pairing with private results. 65 | use -e email@email.net 66 | 67 | 68 | ENVIRONMENT VARIABLES: 69 | 70 | VIRTUAL = If unset, value is FALSE. Set to TRUE if running virtualized (automatically set for Docker) 71 | 72 | EOF 73 | } 74 | 75 | 76 | # Verify if the script is executed with Root Privileges # 77 | rootcheck() 78 | { 79 | if [[ $EUID -ne 0 ]]; then 80 | echo "This script must be run as root" 81 | echo "Ex. "sudo ./linux-bench.sh"" 82 | exit 1 83 | fi 84 | } 85 | 86 | 87 | #Set Functions 88 | setup() 89 | { 90 | benchdir=`pwd` 91 | NEED_PTS=1 92 | 93 | date_str="+%Y_%m%d_%H%M%S" 94 | full_date=`date $date_str` 95 | host=$(hostname) 96 | log="linux-bench"$rev"_"$host"_"$full_date.log 97 | if [ -f /.dockerinit ] ; then 98 | log=/data/"linux-bench"$rev"_"$host"_"$full_date.log 99 | fi 100 | 101 | if [ -n "$isprivate" ]; then 102 | echo $isprivate 103 | fi 104 | 105 | if [ -n "$email" ]; then 106 | echo $email 107 | fi 108 | 109 | #outdir=$host"_"$full_date 110 | #mkdir $outdir 111 | } 112 | 113 | 114 | # Update and install required packages (Debian) 115 | Update_Install_Debian() 116 | { 117 | apt-get update 118 | apt-get -y install build-essential libx11-dev libglu-dev hardinfo sysbench unzip expect php5-curl php5-common php5-cli php5-gd libfpdi-php gfortran curl 119 | mkdir -p /usr/tmp/ 120 | rm /etc/apt/sources.list.d/linuxbench.list 121 | } 122 | 123 | 124 | # Update and install required packages (CentOS/RHEL) 125 | Update_Install_RHEL() 126 | { 127 | rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 128 | rpm -Uhv http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 129 | yum -y groupinstall "Development Tools" && yum -y install wget sysbench unzip libX11 perl-Time-HiRes mesa-libGLU hardinfo expect php-common glibc.i686 gfortran curl 130 | } 131 | 132 | 133 | # Detects which OS and if it is Linux then it will detect which Linux Distribution. 134 | whichdistro() 135 | { 136 | OS=`uname -s` 137 | REV=`uname -r` 138 | MACH=`uname -m` 139 | if [ -f /.dockerinit ]; then 140 | echo "Docker Version"; 141 | fi 142 | if [ "${OS}" = "SunOS" ] ; then 143 | OS=Solaris 144 | DIST=Solaris 145 | ARCH=`uname -p` 146 | OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" 147 | elif [ "${OS}" = "AIX" ] ; then 148 | DIST=AIX 149 | OSSTR="${OS} `oslevel` (`oslevel -r`)" 150 | 151 | elif [ "${OS}" = "Linux" ] ; then 152 | KERNEL=`uname -r` 153 | 154 | if [ -f /etc/redhat-release ] ; then 155 | DIST='RedHat' 156 | PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` 157 | REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` 158 | 159 | elif [ -f /etc/centos-release ] ; then 160 | DIST='CentOS' 161 | PSUEDONAME=`cat /etc/centos-release | sed s/.*\(// | sed s/\)//` 162 | REV=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//` 163 | 164 | elif [ -f /etc/SuSE-release ] ; then 165 | DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` 166 | REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //` 167 | 168 | elif [ -f /etc/mandrake-release ] ; then 169 | DIST='Mandrake' 170 | PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` 171 | REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` 172 | 173 | elif [ -f /etc/debian_version ] ; then 174 | DIST="Debian" 175 | PSUEDONAME=`cat /etc/debian_version` 176 | REV="" 177 | if [ `grep DISTRIB_ID= /etc/lsb-release | cut -d"=" -f2` = "Ubuntu" ] ; then 178 | DIST="Ubuntu" 179 | UBUNTU_RELEASE=`lsb_release -sc` 180 | REPO1="deb http://us.archive.ubuntu.com/ubuntu/ " 181 | REPO1END=" universe" 182 | echo $REPO1 $UBUNTU_RELEASE $REPO1END > /etc/apt/sources.list.d/linuxbench.list 183 | fi 184 | 185 | elif [ -f /etc/UnitedLinux-release ] ; then 186 | DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" 187 | 188 | else 189 | DIST='Not detected' 190 | fi 191 | 192 | OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})" 193 | fi 194 | } 195 | 196 | 197 | # Update and install required packages 198 | dlDependancies() 199 | { 200 | if [ -f /.dockerinit ] ; then 201 | echo "In a Docker container, no updates run." 202 | VIRTUAL="TRUE" 203 | elif [ "${DIST}" = "CentOS" ] ; then 204 | Update_Install_RHEL 205 | elif [ "${DIST}" = "RedHat" ] ; then 206 | Update_Install_RHEL 207 | elif [ "${DIST}" = "Debian" ] || [ "${DIST}" = "Ubuntu" ] ; then 208 | Update_Install_Debian 209 | fi 210 | } 211 | 212 | 213 | # Display script output and append to log 214 | benchlog() 215 | { 216 | exec > >(tee --append $log) 217 | echo $ref >> $log 218 | exec 2>&1 219 | echo ${OSSTR} 220 | } 221 | 222 | 223 | extract() 224 | { 225 | if [ -e ./$appbin ] ; then 226 | echo "$apptgz already installed" 227 | elif [ -e ./$apptgz ] ; then 228 | tar $tgzstring $apptgz 229 | else 230 | wget $appdlpath 231 | tar $tgzstring $apptgz 232 | fi 233 | } 234 | 235 | 236 | #System information and log capture. 237 | sysinfo() 238 | { 239 | eval "strings `which lscpu`" | grep -q version ; 240 | if [ $? = 0 ] ; then 241 | lscpu 242 | lscpu -V 243 | lscpu -e 244 | else 245 | lscpu; 246 | fi 247 | : ${VIRTUAL:=FALSE} 248 | echo "VIRTUAL="$VIRTUAL 249 | 250 | 251 | # Check to see if the CPU is an Intel/AMD or ARM 252 | # This is a simple check for now. 253 | 254 | cpu_check=$(grep 'CPU architecture' /proc/cpuinfo) 255 | if [ $? -ne 0 ] ; then 256 | CPU=x86 257 | else 258 | CPU=ARM; 259 | fi 260 | 261 | echo "CPU="$CPU 262 | 263 | echo "Linux-Bench Version="$rev 264 | } 265 | 266 | proc_define() 267 | { 268 | # Physical sockets 269 | sockets=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 270 | 271 | # Physical Cores 272 | if [[ $CPU == "x86" ]] ; then 273 | procs=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l) 274 | pcores=$(grep "cpu cores" /proc/cpuinfo |sort -u |cut -d":" -f2) 275 | cores=$((procs*pcores)) 276 | elif [[ $CPU == "ARM" ]] ; then 277 | cores=$(grep "processor" /proc/cpuinfo | wc -l) 278 | else 279 | echo "Unknown CPU" 280 | fi 281 | 282 | # Virtual Cores (include threads) 283 | vcores=$(grep "processor" /proc/cpuinfo | wc -l) 284 | threads=$vcores 285 | nproc=$vcores 286 | 287 | } 288 | 289 | 290 | # HardInfo 291 | hardi() 292 | { 293 | cd $benchdir 294 | echo "Running HardInfo test" 295 | hardinfo --generate-report --report-format text 296 | } 297 | 298 | # UnixBench 5.1.3 299 | ubench() 300 | { 301 | cd $benchdir 302 | echo "Building UnixBench" 303 | wget -N https://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz 304 | wget -N http://files.linux-bench.com/lb/fix-limitation.patch 305 | tar -zxf UnixBench5.1.3.tgz 306 | 307 | cd UnixBench 308 | mv ../fix-limitation.patch . 309 | make 310 | patch Run fix-limitation.patch 311 | echo "Running UnixBench" 312 | ./Run dhry2reg whetstone-double syscall pipe context1 spawn execl shell1 shell8 shell16 313 | cd $benchdir 314 | rm -rf UnixBench* fix-limitation.patch 315 | 316 | } 317 | 318 | # C-Ray 1.1 319 | cray() 320 | { 321 | cd $benchdir 322 | 323 | appbase=c-ray-1.1 324 | apptgz=c-ray-1.1.tar.gz 325 | tgzstring=xfz 326 | appbin=$appbase/c-ray-mt 327 | appdlpath=http://www.futuretech.blinkenlights.nl/depot/$apptgz 328 | extract 329 | 330 | echo "Running C-Ray test" 331 | cd c-ray-1.1 && make 332 | echo "c-ray Easy Test" 333 | cat scene | ./c-ray-mt -t $threads -s 7500x3500 > foo.ppm 334 | echo "c-ray Medium Test" 335 | cat sphfract | ./c-ray-mt -t $threads -s 1920x1200 -r 8 > foo.ppm 336 | echo "c-ray Hard Test" 337 | cat sphfract | ./c-ray-mt -t $threads -s 3840x2160 -r 8 > foo.ppm 338 | cd $benchdir 339 | rm -rf $appbase* 340 | 341 | } 342 | 343 | # STREAM by Dr. John D. McCalpin 344 | stream() 345 | { 346 | cd $benchdir 347 | echo "Building STREAM" 348 | 349 | if [ -e stream.c ] ; then 350 | echo "Stream downloaded" 351 | else 352 | wget -N http://www.cs.virginia.edu/stream/FTP/Code/stream.c 353 | fi 354 | 355 | gcc stream.c -O3 -march=native -fopenmp -o stream-me 356 | 357 | export OMP_NUM_THREADS=$cores 358 | export GOMP_CPU_AFFINITY=0-$((cores-1)) 359 | echo $GOMP_CPU_AFFINITY 360 | 361 | echo "Running STREAM test" 362 | ./stream-me 363 | 364 | cd $benchdir 365 | rm -rf stream-me stream.c 366 | } 367 | 368 | # OpenSSL 369 | OSSL() 370 | { 371 | cd $benchdir 372 | 373 | appbase=openssl-1.0.1g 374 | apptgz=openssl-1.0.1g.tar.gz 375 | tgzstring=xfz 376 | appbin=$appbase/apps/openssl 377 | appdlpath=http://www.openssl.org/source/$apptgz 378 | extract 379 | 380 | cd openssl-1.0.1g/ 381 | echo "Building OpenSSL" 382 | ./config no-zlib 2>&1 >> /dev/null 383 | make 2>&1 >> /dev/null 384 | echo "Running OpenSSL test" 385 | ./apps/openssl speed rsa4096 -multi $nproc 386 | 387 | cd $benchdir 388 | rm -rf openssl* 389 | 390 | 391 | } 392 | 393 | crafty() 394 | { 395 | cd $benchdir 396 | wget -N http://www.craftychess.com/crafty-23.4.zip 397 | unzip -o crafty-23.4.zip 398 | cd crafty-23.4/ 399 | export target=LINUX 400 | export CFLAGS="-Wall -pipe -O3 -fomit-frame-pointer $CFLAGS" 401 | export CXFLAGS="-Wall -pipe -O3 -fomit-frame-pointer" 402 | export LDFLAGS="$LDFLAGS -lstdc++" 403 | make crafty-make 404 | chmod +x crafty 405 | ./crafty bench end 406 | 407 | cd $benchdir 408 | rm -rf crafty* 409 | 410 | } 411 | 412 | 413 | 414 | # sysbench CPU test prime 415 | sysb() 416 | { 417 | cd $benchdir 418 | echo "Running sysbench CPU Single Thread" 419 | sysbench --test=cpu --cpu-max-prime=30000 run 420 | echo "Running sysbench CPU Multi-Threaded" 421 | sysbench --num-threads=$nproc --test=cpu --cpu-max-prime=300000 run 422 | } 423 | 424 | 425 | # redis Benchmark based on feedback. Next step is to add memchached as seen here: http://oldblog.antirez.com/post/redis-memcached-benchmark.html 426 | red() 427 | { 428 | cd $benchdir 429 | echo "Building Redis" 430 | 431 | wget http://download.redis.io/redis-stable.tar.gz 432 | tar xzf redis-stable.tar.gz && cd redis-stable && make install 433 | cp utils/redis_init_script /etc/init.d/redis_6379 434 | mkdir -p /var/redis/6379 435 | wget http://files.linux-bench.com/lb/6379.conf 436 | mkdir -p /etc/redis 437 | cp ./6379.conf /etc/redis 438 | 439 | service redis_6379 start 440 | 441 | # Original redis benchmark set/ get test 442 | 443 | echo "Running Redis test" 444 | redis-benchmark -n 1000000 -t set,get -P 32 -q -c 200 445 | 446 | BIN=redis-benchmark 447 | 448 | payload=32 449 | iterations=10000 450 | keyspace=100000 451 | 452 | for clients in 1 5 10 25 50 75 100 453 | do 454 | SPEED=0 455 | for dummy in 0 1 2 456 | do 457 | S=$($BIN -n $iterations -r $keyspace -d $payload -c $clients | grep 'per second' | tail -1 | awk '{print $1}') 458 | VALUE=$(echo $S | awk '{printf "%.0f",$1}') 459 | if [ $(($VALUE > $SPEED)) != 0 ] 460 | then 461 | SPEED=$VALUE 462 | fi 463 | done 464 | echo "$clients $SPEED" 465 | done 466 | 467 | redis-cli shutdown 468 | 469 | cd $benchdir 470 | rm -rf redis* /etc/redis /var/redis* /usr/local/bin/redis-* /etc/init.d/redis_* 471 | 472 | } 473 | 474 | 475 | # NPB Benchmarks 476 | NPB() 477 | { 478 | cd $benchdir 479 | 480 | apptgz=NPB3.3.1.tar.gz 481 | appbin=NPB3.3.1/NPB3.3-OMP 482 | appdlpath=http://http://files.linux-bench.com/lb/$apptgz 483 | tgzstring=xfz 484 | extract 485 | 486 | cd NPB3.3.1/NPB3.3-OMP/ 487 | echo "Building NPB" 488 | 489 | # Use the provided makefile definitions 490 | cp config/NAS.samples/make.def.gcc_x86 config/make.def 491 | 492 | # Define which tests to build 493 | echo "ft A" >> config/suite.def 494 | #echo "mg A" >> config/suite.def 495 | #echo "sp A" >> config/suite.def 496 | #echo "lu A" >> config/suite.def 497 | echo "bt A" >> config/suite.def 498 | #echo "is A" >> config/suite.def 499 | #echo "ep A" >> config/suite.def 500 | #echo "cg A" >> config/suite.def 501 | #echo "ua A" >> config/suite.def 502 | #echo "dc A" >> config/suite.def 503 | 504 | make suite 505 | 506 | export OMP_NUM_THREADS=$cores 507 | 508 | echo "Running NPB tests" 509 | bin/bt.A.x 510 | bin/ft.A.x 511 | 512 | cd $benchdir 513 | rm -rf NPB* 514 | } 515 | 516 | 517 | # NAMD Benchmark http://www.ks.uiuc.edu/Research/namd/performance.html 518 | NAMD() 519 | { 520 | echo "Building NAMD" 521 | cd $benchdir 522 | 523 | appbase=NAMD_2.9_Linux-x86_64-multicore 524 | apptgz=NAMD_2.9_Linux-x86_64-multicore.tar.gz 525 | tgzstring=xfz 526 | appbin=$appbase/namd2 527 | appdlpath=http://http://files.linux-bench.com/lb/$apptgz 528 | extract 529 | 530 | appbase=apoa1 531 | apptgz=apoa1.tar.gz 532 | tgzstring=xfz 533 | appbin=$appbase/apoa1.pdb 534 | appdlpath=http://http://files.linux-bench.com/lb/$apptgz 535 | extract 536 | 537 | echo "Using" $threads "threads" 538 | echo "Running NAMD benchmark... (will take a while)" 539 | 540 | cd NAMD_2.9_Linux-x86_64-multicore 541 | timeperstep=$(./namd2 +p$threads +setcpuaffinity ../apoa1/apoa1.namd | grep "Benchmark time" | tail -1 | cut -d" " -f6) 542 | 543 | echo "Time per step" $timeperstep 544 | 545 | cd $benchdir 546 | rm -rf NAMD* apoa1* 547 | 548 | } 549 | 550 | # p7zip 551 | p7zip() 552 | { 553 | cd $benchdir 554 | 555 | appbase=p7zip_9.20.1 556 | apptgz=p7zip_9.20.1_src_all.tar.bz2 557 | tgzstring=xfj 558 | appbin=p7zip_9.20.1/bin/7za 559 | appdlpath=http://http://files.linux-bench.com/lb/$apptgz 560 | extract 561 | 562 | echo "Building p7zip" 563 | cd $appbase 564 | make 2>&1 >> /dev/null 565 | 566 | echo "Starting 7zip benchmark, this will take a while" 567 | bin/7za b >> output.txt 568 | 569 | compressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f4) 570 | decompressmips=$(grep Avr output.txt | tr -s ' ' |cut -d" " -f7) 571 | 572 | echo "Compress speed (MIPS):" $compressmips 573 | echo "Decompress speed (MIPS):" $decompressmips 574 | 575 | cd $benchdir 576 | rm -rf p7zip* 577 | 578 | 579 | } 580 | 581 | runBenches() 582 | { 583 | #Individual modules run below...comment them out to prevent them from running. 584 | #echo ${iterations:=1} passes 585 | # while [ $iterations -gt 0 ] ; do 586 | echo "hardinfo" 587 | time hardi 588 | echo "ubench" 589 | time ubench 590 | echo "cray" 591 | time cray 592 | echo "stream" 593 | time stream 594 | echo "OSSL" 595 | time OSSL 596 | echo "sysbench" 597 | time sysb 598 | echo "redis" 599 | time red 600 | echo "NPB" 601 | time NPB 602 | echo "NAMD" 603 | time NAMD 604 | echo "p7zip" 605 | time p7zip 606 | # let iterations-=1 607 | # done 608 | 609 | } 610 | 611 | 612 | 613 | # Runtime This is where everything is actually run from and called... 614 | # 615 | # This is where a menu would go for runtime options... 616 | # 617 | 618 | main() 619 | { 620 | rootcheck 621 | 622 | while getopts "hVRpe:" arg; do 623 | 624 | case $arg in 625 | h) 626 | usage 627 | exit 1 628 | ;; 629 | V) 630 | version 631 | exit 1 632 | ;; 633 | p) 634 | isprivate="Private Result" 635 | ;; 636 | e) 637 | email="Send Linux-Bench result to: $OPTARG" 638 | ;; 639 | \?) 640 | usage 641 | exit 1 642 | ;; 643 | esac 644 | done 645 | 646 | echo "setup" 647 | setup 648 | echo "version" 649 | version 650 | echo "whichdistro" 651 | whichdistro 652 | echo "dlDep" 653 | dlDependancies 654 | echo "benchlog" 655 | benchlog 656 | echo "derpinfo" 657 | sysinfo exiting on sysinfo... 658 | sysinfo 659 | echo "proc_define" 660 | proc_define 661 | echo "run benches" 662 | runBenches 663 | echo "done" 664 | } 665 | 666 | push_data() { 667 | ref=$(date +%S%d$i%s) 668 | echo "ref_link: $ref" 669 | echo "Docker Version" 670 | echo "See your results online at: http://linux-bench.com/display/$ref" 671 | # mkdir tmpbench && cp $log tmpbench/. 672 | sleep 1s 673 | curl -F file="@./tmpbench/$log" http://linux-bench.com:3000/java-process/uploader -H "Connection: close" 674 | # curl --form file="@./tmpbench/$log" --form press=Upload http://beta.linux-bench.com/upload_file/ --trace-ascii dumpfile 675 | # rm -rf ./tmpbench/ 676 | curl --form file="@./$log" --form press=Upload http://beta.linux-bench.com/upload_file/ --trace-ascii dumpfile 677 | curl --form file="@./$log" --form press=Upload http://linux-bench.com/upload_file/ --trace-ascii dumpfile 678 | 679 | } 680 | 681 | # Execute everything in the script 682 | main 683 | push_data 684 | --------------------------------------------------------------------------------