linux中利用unixbench进行性能测试 【百科全说】-pg电子游戏试玩平台网站

腾讯视频/爱奇艺/优酷/外卖 充值4折起

unixbench是一款开源的测试 unix 系统基本性能的工具,是比较通用的测试vps性能的工具. unixbench会执行一系列的测试,包括2d和3d图形系统的性能衡量,测试的结果不仅仅只是cpu,内存,或者磁盘为基准,还取决于硬件,操作系统版本,编译器.


unixbench是一个类unix系(unix,bsd,linux)统下的性能测试工具,一个开源工具,被广泛用与测试linux系统主机的性能。unixbench的主要测试项目有:系统调用、读写、进程、图形化测试、2d、3d、管道、运算、c库等系统基准性能提供测试数据。

最新版本unixbench5.1.3,包含system和graphic测试,如果你需要测试graphic,则需要修改makefile,不要注释掉”graphic_tests = defined”,同时需要系统提供x11perf命令gl_glibs库。
下面的脚本使用了最新版unixbench5.1.3来测试,注释了关于graphic的测试项(大多数vps都是没有显卡或者是集显,所以图像性能无需测试),运行10-30分钟后(根据cpu内核数量,运算时间不等)得出分数,越高越好。

测试方法:

wget http://file.111cn.net/upload/2014/1/unixbench.sh
chmod x unixbench.sh
./unixbench.sh

或直接把下面代码保存成unixbench.sh

#! /bin/bash
path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export path
#===============================================================================================
# description: unixbench for test
#===============================================================================================

# create new soft download dir
mkdir -p /opt/unixbench;
cd /opt/unixbench;

# download unixbench5.1.3
if [ -s unixbench5.1.3.tgz ]; then
echo "unixbench5.1.3.tgz [found]"
else
echo "unixbench5.1.3.tgz not found!!!download now......"
if ! wget -c http://byte-unixbench.googlecode.com/files/unixbench5.1.3.tgz;then
echo "failed to download unixbench5.1.3.tgz,please download it to "/opt/unixbench" directory manually and rerun the install script."
exit 1
fi
fi
tar -xzf unixbench5.1.3.tgz;
cd unixbench;

yum -y install gcc gcc-c autoconf gcc-c time perl-time-hires

#run unixbench
sed -i "s/graphic_tests = defined/#graphic_tests = defined/g" ./makefile
make;
./run;

echo '';
echo '';
echo '';
echo "======= script description and score comparison completed! ======= ";
echo '';
echo '';
echo '';

测试项目:
dhrystone 2 using register variables
此项用于测试 string handling,因为没有浮点操作,所以深受软件和硬件设计(hardware and software design)、编译和链接(compiler and linker options)、代码优化(code optimazaton)、对内存的cache(cache memory)、等待状态(wait states)、整数数据类型(integer data types)的影响。

double-precision whetstone
这一项测试浮点数操作的速度和效率。这一测试包括几个模块,每个模块都包括一组用于科学计算的操作。覆盖面很广的一系列 c 函数:sin,cos,sqrt,exp,log 被用于整数和浮点数的数学运算、数组访问、条件分支(conditional branch)和程序调用。此测试同时测试了整数和浮点数算术运算。

execl throughput
此测试考察每秒钟可以执行的 execl 系统调用的次数。 execl 系统调用是 exec 函数族的一员。它和其他一些与之相似的命令一样是 execve() 函数的前端。

file copy
测试从一个文件向另外一个文件传输数据的速率。每次测试使用不同大小的缓冲区。这一针对文件 read、write、copy 操作的测试统计规定时间(默认是 10s)内的文件 read、write、copy 操作次数。

pipe throughput
管道(pipe)是进程间交流的最简单方式,这里的 pipe throughtput 指的是一秒钟内一个进程可以向一个管道写 512 字节数据然后再读回的次数。需要注意的是,pipe throughtput 在实际编程中没有对应的真实存在。

pipe-based context switching
这个测试两个进程(每秒钟)通过一个管道交换一个不断增长的整数的次数。这一点很向现实编程中的一些应用,这个测试程序首先创建一个子进程,再和这个子进程进行双向的管道传输。

process creation
测试每秒钟一个进程可以创建子进程然后收回子进程的次数(子进程一定立即退出)。process creation 的关注点是新进程进程控制块(process control block)的创建和内存分配,即一针见血地关注内存带宽。一般说来,这个测试被用于对操作系统进程创建这一系统调用的不同实现的比较。

system call overhead
测试进入和离开操作系统内核的代价,即一次系统调用的代价。它利用一个反复地调用 getpid 函数的小程序达到此目的。

shell scripts
测试一秒钟内一个进程可以并发地开始一个 shell 脚本的 n 个拷贝的次数,n 一般取值 1,2,4,8。(我在测试时取 1, 8)。这个脚本对一个数据文件进行一系列的变形操作(transformation)。

下面是我的一个512mb,2核,openvz的vps的跑分结果:

byte unix benchmarks (version 5.1.3)

system: vpn: gnu/linux
os: gnu/linux -- 2.6.32-042stab076.8 -- #1 smp tue may 14 20:38:14 msk 2013
machine: i686 (i386)
language: en_us.utf8 (charmap="utf-8", collate="utf-8")
cpu 0: intel(r) xeon(r) cpu l5520 @ 2.27ghz (4533.6 bogomips)
hyper-threading, x86-64, mmx, physical address ext, sysenter/sysexit, syscall/sysret, intel virtualization
cpu 1: intel(r) xeon(r) cpu l5520 @ 2.27ghz (4533.6 bogomips)
hyper-threading, x86-64, mmx, physical address ext, sysenter/sysexit, syscall/sysret, intel virtualization
09:41:17 up 31 days, 9:21, 1 user, load average: 0.23, 0.05, 0.02; runlevel 3

------------------------------------------------------------------------
benchmark run: mon jul 29 2013 09:41:17 - 10:09:29
2 cpus in system; running 1 parallel copy of tests

dhrystone 2 using register variables 17172222.3 lps (10.0 s, 7 samples)
double-precision whetstone 2600.2 mwips (10.0 s, 7 samples)
execl throughput 4152.8 lps (30.0 s, 2 samples)
file copy 1024 bufsize 2000 maxblocks 622759.5 kbps (30.0 s, 2 samples)
file copy 256 bufsize 500 maxblocks 172634.3 kbps (30.0 s, 2 samples)
file copy 4096 bufsize 8000 maxblocks 1218236.9 kbps (30.0 s, 2 samples)
pipe throughput 1416230.5 lps (10.0 s, 7 samples)
pipe-based context switching 206509.4 lps (10.0 s, 7 samples)
process creation 8568.6 lps (30.0 s, 2 samples)
shell scripts (1 concurrent) 3145.9 lpm (60.0 s, 2 samples)
shell scripts (8 concurrent) 528.3 lpm (60.0 s, 2 samples)
system call overhead 1528474.7 lps (10.0 s, 7 samples)

system benchmarks index values baseline result index
dhrystone 2 using register variables 116700.0 17172222.3 1471.5
double-precision whetstone 55.0 2600.2 472.8
execl throughput 43.0 4152.8 965.8
file copy 1024 bufsize 2000 maxblocks 3960.0 622759.5 1572.6
file copy 256 bufsize 500 maxblocks 1655.0 172634.3 1043.1
file copy 4096 bufsize 8000 maxblocks 5800.0 1218236.9 2100.4
pipe throughput 12440.0 1416230.5 1138.4
pipe-based context switching 4000.0 206509.4 516.3
process creation 126.0 8568.6 680.0
shell scripts (1 concurrent) 42.4 3145.9 742.0
shell scripts (8 concurrent) 6.0 528.3 880.5
system call overhead 15000.0 1528474.7 1019.0
========
system benchmarks index score 960.4

------------------------------------------------------------------------
benchmark run: mon jul 29 2013 10:09:29 - 10:39:56
2 cpus in system; running 2 parallel copies of tests

dhrystone 2 using register variables 16851634.7 lps (10.0 s, 7 samples)
double-precision whetstone 5182.9 mwips (10.0 s, 7 samples)
execl throughput 4101.9 lps (30.0 s, 2 samples)
file copy 1024 bufsize 2000 maxblocks 635244.9 kbps (30.0 s, 2 samples)
file copy 256 bufsize 500 maxblocks 174430.2 kbps (30.0 s, 2 samples)
file copy 4096 bufsize 8000 maxblocks 1219982.0 kbps (30.0 s, 2 samples)
pipe throughput 1387297.9 lps (10.0 s, 7 samples)
pipe-based context switching 196296.1 lps (10.0 s, 7 samples)
process creation 10889.9 lps (30.0 s, 2 samples)
shell scripts (1 concurrent) 4073.7 lpm (60.0 s, 2 samples)
shell scripts (8 concurrent) 550.5 lpm (60.2 s, 2 samples)
system call overhead 1538517.4 lps (10.0 s, 7 samples)

system benchmarks index values baseline result index
dhrystone 2 using register variables 116700.0 16851634.7 1444.0
double-precision whetstone 55.0 5182.9 942.3
execl throughput 43.0 4101.9 953.9
file copy 1024 bufsize 2000 maxblocks 3960.0 635244.9 1604.2
file copy 256 bufsize 500 maxblocks 1655.0 174430.2 1054.0
file copy 4096 bufsize 8000 maxblocks 5800.0 1219982.0 2103.4
pipe throughput 12440.0 1387297.9 1115.2
pipe-based context switching 4000.0 196296.1 490.7
process creation 126.0 10889.9 864.3
shell scripts (1 concurrent) 42.4 4073.7 960.8
shell scripts (8 concurrent) 6.0 550.5 917.5
system call overhead 15000.0 1538517.4 1025.7
========
system benchmarks index score

06/23 16:19
unixbench是什么? unixbench是一套unix系统基准测试套件.unixbench的设计目标是为类unix系统提供一套基本的指标,所以有许多项目测试系统各方面的性能.各项的测试有得分,然后有一个综合的得分,这样可以很方便的通过分数去比较. unixbench也包含一些非常简单的2d和3d图形测试. unixbench也支持多cpu系统的测试,默认的行为是测试两次,第一次是一个进程的测试,第二次是n份测试,n等于cpu个数.这样的设计是为了以下目标: 测试系统的单任务性能 测试系统的
04/29 00:49
shell脚本 说做就做,简单的写了个 shell 脚本就搞定了! 脚本名称:网站死链生成脚本 脚本功能:每天定时分析网站前一天的 nginx 日志, 然后提取状态码为404并且ua为百度蜘蛛的抓取路径,并写入到网站根目录下的 death.txt 文件,用于提交百度死链。 脚本代码: #!/bin/bash #desc: death chain file script #author: zhangge #blog: http://你的域名/5038.html #date: 2015-05-03
12/05 13:36
在linux操作系统中,我们只要简单的设置就能将linux变成一台优秀的路由器,实现路由转发,下面将通过三台机子的实现来给大家详细介绍下如何利用pc机来实现路由转发,一起来学习下吧。 1、网络拓扑 网络拓扑如下所示,我们在这里用到了三台机子做实验,分别是①、④、⑦号机,使用①号机ping⑦号机,④号机作为路由转发。 2、错误的路由配置 首先我们使用如下的配置方法,配置这三台机子的路由表: 1)在①号机种配置如下,让目的网段是10.0.4.0/24的从eth1端口出去
05/19 00:39
问题描述 解决方法 分析原因,可能因为我平台迁移碰到权限问题我们来进行权限转换 1)在windows下转换: 利用一些编辑器如ultraedit或editplus等工具先将脚本编码转换,再放到linux中执行。转换方式如下(ultraedit):file-->conversions-->dos->unix即可。 2)方法 用vim打开该sh文件,输入: [plain] :set ff 回车,显示fileformat=dos,重新设置下文件
06/30 17:03
rsync 非常适合在两台机器之间快速同步大型、复杂的目录,例如论坛的附件目录。再配合 ssh ,则安全性也有保证,且可以利用 ssh public key 和 cron 来进行自动定时同步。 说明:两台机器分别为 localhost 和 remotehost ;用户分别为 localuser 和 remoteuser。 环境:freebsd 4.9 和 freebsd 6.1 代码如下 设置 ssh public key 认证 $ssh-keygen -t dsa -b 2048 生成所需的密
02/17 22:40
eaccelerator与zend optimizer是一个加速软件了,我们可以利用它与php环境同步运行使用得php性能更好了,下面来一起看看linux中安装zend optimizer与eaccelerator教程 下载zend optimizer http://downloads.zend.com/optimizer/3.3.9/zendoptimizer-3.3.9-linux-glibc23-i386.tar.gz tar -xzvf zendoptimizer-3.3.9-linux
03/07 01:53
所谓压缩就是将原有的文件通过不同的编码技术进行运算,以减少数据存储所需要的空间,使用前再利用解压缩还原源文件的内容即可. 和windows一样,在linux下也存在多种压缩与解压缩方法. 1.zip压缩与解压缩 zip是最为广泛使用的压缩程序,经它压缩的文件会产生扩展名为zip的压缩文件,而且这种格式在多种系统上可以使用,像windows中的winzip 下面看一下在linux中如何建立zip文件. 我们在终端中输入zip会出现这个命令的一些介绍和参数的意义. 代码如下: xiaopeng@ub
06/01 16:48
http_load是基于linux平台的一种性能测工具.它是以并行复用的方式运行,仅适用于web页面的性能测试,不适用于访问数据库,而且测试结果分析是有限的,平台依赖linux .http_load可以简单地通过txt文本文件中记录的参数来对http服务器进行压力测试,那是如何对服务器进行压力测试的呢?下面我们就来介绍 linux中如何安装使用http_load对服务器进行压力测试的教程. 具体方法步骤如下: 1.下载 官方网站:http://acme.com/software/http_loa
06/18 12:34
1 什么是 core dumpcore dump 又叫核心转储.在程序运行过程中发生异常时,将其内存数据保存到文件中,这个过程叫做 core dump. 2 core dump 的作用在开发过程中,难免会遇到程序运行过程中异常退出的情况,这时候想要定位哪里出了问题,仅仅依靠程序自身的信息打印(日志记录)往往是不够的,这个时候就需要 core dump 文件来帮忙了.一个完整的 core dump 文件实际上相当于恢复了异常现场,利用 core dump 文件,可以查看到程序异常时的所有信息,变量
网站地图