lmbench-1 编译和运行

https://github.com/intel/lmbench

编译

安装依赖:

yum install -y libtirpc libtirpc-devel

修改scripts/build脚本,在LDLIBS=-lm下面添加两行:

LDLIBS="${LDLIBS} -ltirpc"
CFLAGS="${CFLAGS} -I/usr/include/tirpc"

运行

make results # 首先会执行交互式配置,配置文件生成并保存于 ./bin/$OS/CONFIG.xxx
             # 内存可选则小一点,send mail选择no
             # 随后进行测试,执行较久
             # 所有都执行的话,执行内容较多 可以直接cd src && make hardware 仅测试硬件
make see     # 查看报告

过程分析

执行过程分析:

results: lmbench
        @env OS="${OS}" ../scripts/config-run # 配置文件生成于 ./bin/$OS/CONFIG.xxx
        @env OS="${OS}" ../scripts/results
        

scripts/results:

. ../bin/$OS/$CONFIG
...
RESULTS=results/$OS/xxx # 了解测试进度可以通过tail 这个文件进行了解
...
./lmbench $CONFIG 2>../${RESULTS}
. ../bin/x86_64-linux-gnu/CONFIG.localhost.localdomain
# bash -x ./lmbench CONFIG.localhost.localdomain 2> my.log 这一步其实就是lmbench脚本调用`./bin/`下的可执行文件去执行

# grep BENCHMARK_HARDWARE scripts/lmbench -A 50

if [ X$BENCHMARK_HARDWARE = XYES ]; then
        if [ X"$DISKS" != X ]
        then    for i in $DISKS
                do      if [ -r $i ]
                        then    echo "Calculating disk zone bw & seek times" \
                                        >> ${OUTPUT}
                                msleep 250
                                disk $i
                                echo "" 1>&2
                        fi
                done
        fi
fi

if [ X$BENCHMARK_OS = XYES -o X$BENCHMARK_HARDWARE = XYES -o X$BENCHMARK_BCOPY = XYES ]; then
        echo "" 1>&2
        echo "libc bcopy unaligned" 1>&2
        for i in $HALF; do bw_mem -P $SYNC_MAX $i bcopy; done; echo "" 1>&2

        echo "libc bcopy aligned" 1>&2
        for i in $HALF; do bw_mem -P $SYNC_MAX $i bcopy conflict; done; echo "" 1>&2

        echo "Memory bzero bandwidth" 1>&2
        for i in $ALL; do bw_mem -P $SYNC_MAX $i bzero; done; echo "" 1>&2

        echo "unrolled bcopy unaligned" 1>&2
        for i in $HALF; do bw_mem -P $SYNC_MAX $i fcp; done; echo "" 1>&2

        echo "unrolled partial bcopy unaligned" 1>&2
        for i in $HALF; do bw_mem -P $SYNC_MAX $i cp; done; echo "" 1>&2

        echo "Memory read bandwidth" 1>&2
        for i in $ALL; do bw_mem -P $SYNC_MAX $i frd; done; echo "" 1>&2

        echo "Memory partial read bandwidth" 1>&2
        for i in $ALL; do bw_mem -P $SYNC_MAX $i rd; done; echo "" 1>&2

        echo "Memory write bandwidth" 1>&2
        for i in $ALL; do bw_mem -P $SYNC_MAX $i fwr; done; echo "" 1>&2

        echo "Memory partial write bandwidth" 1>&2
        for i in $ALL; do bw_mem -P $SYNC_MAX $i wr; done; echo "" 1>&2

        echo "Memory partial read/write bandwidth" 1>&2
        for i in $ALL; do bw_mem -P $SYNC_MAX $i rdwr; done; echo "" 1>&2
fi


if [ X$BENCHMARK_HARDWARE = XYES -o X$BENCHMARK_MEM = XYES ]; then
        if [ $SYNC_MAX = 1 ]; then
            date >> ${OUTPUT}
            echo "Calculating effective TLB size" >> ${OUTPUT}
            msleep 250
            tlb -L $LINE_SIZE -M ${MB}M
            echo "" 1>&2

            date >> ${OUTPUT}
            echo "Calculating memory load parallelism" >> ${OUTPUT}
            msleep 250
            echo "Memory load parallelism" 1>&2
            par_mem -L $LINE_SIZE -M ${MB}M
            echo "" 1>&2

#           date >> ${OUTPUT}
#           echo Calculating cache parameters >> ${OUTPUT}
#           msleep 250
#           cache -L $LINE_SIZE -M ${MB}M
        fi

        date >> ${OUTPUT}
        echo "McCalpin\'s STREAM benchmark" >> ${OUTPUT}
        msleep 250
        stream -P $SYNC_MAX -M ${MB}M
        stream -P $SYNC_MAX -v 2 -M ${MB}M

        date >> ${OUTPUT}
        echo "Calculating memory load latency" >> ${OUTPUT}
        msleep 250
        echo "" 1>&2
        echo "Memory load latency" 1>&2
        if [ X$FASTMEM = XYES ]
        then    lat_mem_rd -P $SYNC_MAX $MB 128
        else    lat_mem_rd -P $SYNC_MAX $MB 16 32 64 128 256 512 1024 
        fi
        echo "" 1>&2
        echo "Random load latency" 1>&2
        lat_mem_rd -t -P $SYNC_MAX $MB 16
        echo "" 1>&2
fi

附: 测试记录

点击查看代码
[root@localhost lmbench-master]# make see
cd results && make summary percent 2>/dev/null | more
make[1]: 进入目录“/root/lybdir/lmbench/lmbench-master/results”

                 L M B E N C H  3 . 0   S U M M A R Y
                 ------------------------------------
                 (Alpha software, do not distribute)

Basic system parameters
------------------------------------------------------------------------------
Host                 OS Description              Mhz  tlb  cache  mem   scal
                                                     pages line   par   load
                                                           bytes  
--------- ------------- ----------------------- ---- ----- ----- ------ ----
localhost Linux 5.10.0-        x86_64-linux-gnu 1598         128 6.5500    1

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 5.10.0- 1598 0.10 0.14 0.64 1.18 2.28 0.16 0.91               
localhost Linux 5.10.0- 1598 0.10 0.15 0.66 1.22 2.35 0.18 0.96 261. 1313 2077
localhost Linux 5.10.0- 1598 0.11 0.15 0.66 1.18 2.53 0.16 0.89 267. 1346 2094

Basic integer operations - times in nanoseconds - smaller is better
-------------------------------------------------------------------
Host                 OS  intgr intgr  intgr  intgr  intgr  
                          bit   add    mul    div    mod   
--------- ------------- ------ ------ ------ ------ ------ 
localhost Linux 5.10.0- 0.2300        0.9800 9.1400 9.3300
localhost Linux 5.10.0- 0.2300        1.0000 9.3400 9.5600

Basic float operations - times in nanoseconds - smaller is better
-----------------------------------------------------------------
Host                 OS  float  float  float  float
                         add    mul    div    bogo
--------- ------------- ------ ------ ------ ------ 
localhost Linux 5.10.0- 1.3800 1.3200 3.7800 1.0300
localhost Linux 5.10.0- 1.3200 1.3800 3.9100 0.9800

Basic double operations - times in nanoseconds - smaller is better
------------------------------------------------------------------
Host                 OS  double double double double
                         add    mul    div    bogo
--------- ------------- ------  ------ ------ ------ 
localhost Linux 5.10.0- 1.3700 1.3700 4.8500 1.3600
localhost Linux 5.10.0- 1.3800 1.3600 4.8900 1.3700

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 5.10.0- 1.7100 1.7000 2.3300 2.1000 2.0700 2.28000 2.47000

*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 5.10.0-       4.517 5.80                             
localhost Linux 5.10.0- 1.710 4.515 5.80 6.516       9.349        72.

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 5.10.0-                                     0.519         0.986
localhost Linux 5.10.0-                                     0.546         1.019
localhost Linux 5.10.0- 5.5070 4.1514   11.3 6.6444   29.4K 0.411         1.019

*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 5.10.0- 3632 8272 7471 7633.9  12.7K 5649.5 6548.3 12.K 8962.

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 5.10.0-  1598 1.2740 4.4540   19.6        81.5

REFERENCE

posted @ 2024-06-24 18:35  LiYanbin  阅读(81)  评论(0编辑  收藏  举报