lmbench是个用于评价系统综合性能的多平台开源benchmark,能够测试包括文档读写、内存操作、进程创建销毁开销、网络等性能,测试方法简单。
Lmbench是个多平台软件,因此能够对同级别的系统进行比较测试,反映不同系统的优劣势,通过选择不同的库函数我们就能够比较库函数的性能;更为重要的是,作为一个开源软件,lmbench提供一个测试框架,假如测试者对测试项目有更高的测试需要,能够通过少量的修改源代码达到目的(比如现在只能评测进程创建、终止的性能和进程转换的开销,通过修改部分代码即可实现线程级别的性能测试)。
下载:
www.bitmover.com/lmbench,最新版本3.0-a9
主要功能:
*带宽测评工具
—读取缓存文件
—拷贝内存
—读内存
—写内存
—管道
—TCP
* 反应时间测评工具
—上下文切换
—网络: 连接的建立,管道,TCP,UDP和RPC hot potato
—文件系统的建立和删除
—进程创建
—信号处理
—上层的系统调用
—内存读入反应时间
* 其他
—处理器时钟比率计算
cd src # make results实际调用了两个脚本,scripts/lmbench 和 scripts/config-run make results
# 实际调用命令为cd results && make summary percent 2>/dev/null | more make see
其他:
Be warned that many of these benchmarks are sensitive to other things being run on the system, mainly from CPU cache and CPU cycle effects. So make sure your screen saver is not running, etc. It's a good idea to do several runs and compare the output like so
make results make rerun make rerun make rerun cd Results && make LIST=/*
报错及解决办法
make[2]: *** 没有规则可以创建“bk.ver”需要的目标“../SCCS/s.ChangeSet”。 停止。 make[2]:正在离开目录 `/home/hero/lmbench3/src' make[1]: *** [lmbench] 错误 2 make[1]:正在离开目录 `/home/hero/lmbench3/src' make: *** [build] 错误 2
lmbench3目录下 #mkdir SCCS #touch ./SCCS/s.ChangeSet #make
cd results && make summary percent 2>/dev/null | more make[1]: Entering directory `/root/test/lmbench3/results' L M B E N C H 3 . 0 S U M M A R Y ------------------------------------ (Alpha software, do not distribute) Processor, Processes - times in microseconds - smaller is better ------------------------------------------------------------------------------ Host OS Mhz null null open slct sig sig fork exec sh call I/O stat clos TCP inst hndl proc proc proc --------- ------------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- localhost Linux 3.10.0- 2304 0.37 0.48 1.49 2.79 8.57 0.56 1.68 155. 612. 2090 Basic integer operations - times in nanoseconds - smaller is better ------------------------------------------------------------------- Host OS intgr intgr intgr intgr intgr bit add mul div mod --------- ------------- ------ ------ ------ ------ ------ localhost Linux 3.10.0- 0.4500 0.0500 1.4200 11.0 12.2 Basic float operations - times in nanoseconds - smaller is better ----------------------------------------------------------------- Host OS float float float float add mul div bogo --------- ------------- ------ ------ ------ ------ localhost Linux 3.10.0- 1.3500 2.2600 6.0600 3.2900 Basic double operations - times in nanoseconds - smaller is better ------------------------------------------------------------------ Host OS double double double double add mul div bogo --------- ------------- ------ ------ ------ ------ localhost Linux 3.10.0- 1.3400 2.2100 9.0700 6.3900 Context switching - times in microseconds - smaller is better ------------------------------------------------------------------------- Host OS 2p/0K 2p/16K 2p/64K 8p/16K 8p/64K 16p/16K 16p/64K ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw ctxsw --------- ------------- ------ ------ ------ ------ ------ ------- ------- localhost Linux 3.10.0- 2.1300 2.3500 2.4200 2.8300 3.8200 3.16000 4.21000 *Local* Communication latencies in microseconds - smaller is better --------------------------------------------------------------------- Host OS 2p/0K Pipe AF UDP RPC/ TCP RPC/ TCP ctxsw UNIX UDP TCP conn --------- ------------- ----- ----- ---- ----- ----- ----- ----- ---- localhost Linux 3.10.0- 2.130 7.756 8.96 12.7 14.7 38. File & VM system latencies in microseconds - smaller is better ------------------------------------------------------------------------------- Host OS 0K File 10K File Mmap Prot Page 100fd Create Delete Create Delete Latency Fault Fault selct --------- ------------- ------ ------ ------ ------ ------- ----- ------- ----- localhost Linux 3.10.0- 17.2 31.5 248.9 79.8 13.2K 0.754 1.95200 1.743 *Local* Communication bandwidths in MB/s - bigger is better ----------------------------------------------------------------------------- Host OS Pipe AF TCP File Mmap Bcopy Bcopy Mem Mem UNIX reread reread (libc) (hand) read write --------- ------------- ---- ---- ---- ------ ------ ------ ------ ---- ----- localhost Linux 3.10.0- 2369 1745 2586 4274.1 7622.8 4708.3 3248.1 7833 5057. Memory latencies in nanoseconds - smaller is better (WARNING - may not be correct, check graphs) ------------------------------------------------------------------------------ Host OS Mhz L1 $ L2 $ Main mem Rand mem Guesses --------- ------------- --- ---- ---- -------- -------- ------- localhost Linux 3.10.0- 2304 1.7310 8.6750 20.5 159.7 make[1]: Leaving directory `/root/test/lmbench3/results'
关键参数:
L1:缓存1
L2:缓存2
Main Mem:连续内存
Rand Mem:内存随机访问延时
Guesses
假如L1和L2近似,会显示“No L1 cache?”
假如L2和Main Mem近似,会显示“No L2 cache?”
Pipe:管道操作
AF UNIX
Unix协议
TCP
TCP通信
File reread:文档重复读
MMap reread:内存映射重复读
Bcopy(libc):内存拷贝
Bcopy(hand):内存拷贝
Mem read:内存读
Mem write:内存写