Buildroot lmbench使用方法

/**********************************************************************
 *                 Buildroot lmbench使用方法
 * 说明:
 *     想在i.mx6上用Buildroot编译出lmbench,结果发现全是单独的命令,不知道
 * 怎么使用,脚本需要用到perl,所以编译需要选好perl。
 *
 *                                2018-6-21 深圳 宝安西乡 曾剑锋
 *********************************************************************/

一、参考文档:
    1. Performances
        http://www.armadeus.org/wiki/index.php?title=Performances
    2. Linux系统性能测试工具Lmbench
        https://wiki.deepin.io/mediawiki/index.php?title=Linux%E7%B3%BB%E7%BB%9F%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95%E5%B7%A5%E5%85%B7Lmbench
    3. 性能测试工具Lmbench使用说明
        https://wenku.baidu.com/view/aa29812727d3240c8447ef9a.html

二、解决办法:
    1. 将Buildroot编译出来的文件夹打包,目前我自己的是:/output/build/lmbench-3.0-a9
    2. 拷贝到主板上解压;
    3. cd /jump/to/lmbench/dir/
    4. cd scripts
    5. OS=arm ./config-run  (生成的配置放在后面)
        MULTIPLE COPIES [default 1] 2
        Job placement selection: 2
        MB [default ] 8
        SUBSET (ALL|HARWARE|OS|DEVELOPMENT) [default all] HARDWARE
        then default value (except for result mailing, choose no) except
        Processor mhz [default 189 MHz, 5.2910 nanosec clock] 192
        FSDIR [default /var/tmp] /mnt/host/
        Mail results [default yes] no
    6. OS=arm ./results
        Using config in CONFIG.buildroot
        Sat Jan  1 00:05:54 UTC 2000
        Latency measurements
        Sat Jan  1 00:06:50 UTC 2000
        Calculating file system latency
        Sat Jan  1 00:06:52 UTC 2000
        Local networking
        Sat Jan  1 00:09:36 UTC 2000
        Bandwidth measurements
        Sat Jan  1 00:17:04 UTC 2000
        Calculating context switch overhead
        Sat Jan  1 00:18:01 UTC 2000
        McCalpin's STREAM benchmark
        Sat Jan  1 00:18:38 UTC 2000
        Calculating memory load latency

        Sat Jan  1 00:27:37 UTC 2000
    7. ./getsummary ../results/arm/*,
                         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
        --------- ------------- ----------------------- ---- ----- ----- ------ ----
        buildroot Linux 4.1.15+                     arm  996          64           2

        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
        --------- ------------- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
        buildroot Linux 4.1.15+  996 0.23 0.56 5.70 12.1 19.7 0.66 4.03 1303 3049 7073

        Basic integer operations - times in nanoseconds - smaller is better
        -------------------------------------------------------------------
        Host                 OS  intgr intgr  intgr  intgr  intgr
                                  bit   add    mul    div    mod
        --------- ------------- ------ ------ ------ ------ ------

        Basic uint64 operations - times in nanoseconds - smaller is better
        ------------------------------------------------------------------
        Host                 OS int64  int64  int64  int64  int64
                                 bit    add    mul    div    mod
        --------- ------------- ------ ------ ------ ------ ------

        Basic float operations - times in nanoseconds - smaller is better
        -----------------------------------------------------------------
        Host                 OS  float  float  float  float
                                 add    mul    div    bogo
        --------- ------------- ------ ------ ------ ------

        Basic double operations - times in nanoseconds - smaller is better
        ------------------------------------------------------------------
        Host                 OS  double double double double
                                 add    mul    div    bogo
        --------- ------------- ------  ------ ------ ------

        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
        --------- ------------- ------ ------ ------ ------ ------ ------- -------
        buildroot Linux 4.1.15+ 3.6900   10.8   21.9   26.8   46.8    33.3    49.3

        *Local* Communication latencies in microseconds - smaller is better
        ---------------------------------------------------------------------
        Host                 OS 2p/0K  Pipe AF     UDP  RPC/   TCP  RPC/ TCP
                                ctxsw       UNIX         UDP         TCP conn
        --------- ------------- ----- ----- ---- ----- ----- ----- ----- ----
        buildroot Linux 4.1.15+ 3.690  17.2 26.5  76.4        86.0

        *Remote* Communication latencies in microseconds - smaller is better
        ---------------------------------------------------------------------
        Host                 OS   UDP  RPC/  TCP   RPC/ TCP
                                       UDP         TCP  conn
        --------- ------------- ----- ----- ----- ----- ----
        buildroot Linux 4.1.15+

        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
        --------- ------------- ------ ------ ------ ------ ------- ----- ------- -----
        buildroot Linux 4.1.15+                              1998.0 0.207 1.42140 6.259

        *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
        --------- ------------- ---- ---- ---- ------ ------ ------ ------ ---- -----
        buildroot Linux 4.1.15+ 453. 411. 238.  552.7 1214.5  591.4  537.1 1204 596.0

        Memory latencies in nanoseconds - smaller is better
            (WARNING - may not be correct, check graphs)
        ------------------------------------------------------------------------------
        Host                 OS   Mhz   L1 $   L2 $    Main mem    Rand mem    Guesses
        --------- -------------   ---   ----   ----    --------    --------    -------
        buildroot Linux 4.1.15+   996 4.0220   33.7        61.1       316.6

三、生成的配置
    DISKS=""
    DISK_DESC=""
    OUTPUT=/dev/tty
    ENOUGH=5000
    FASTMEM="NO"
    FILE=/var/tmp/XXX
    FSDIR=/var/tmp
    INFO=INFO.buildroot
    LINE_SIZE=64
    LOOP_O=0.00001841
    MAIL=no
    TOTAL_MEM=1001
    MB=8
    MHZ="995 MHz, 1.0050 nanosec clock"
    MOTHERBOARD=""
    NETWORKS=""
    OS="arm"
    PROCESSORS="2"
    REMOTE=""
    SLOWFS="NO"
    SYNC_MAX="2"
    LMBENCH_SCHED="BALANCED"
    TIMING_O=0
    RSH=
    RCP=
    VERSION=3.0-a9
    BENCHMARK_HARDWARE=YES
    BENCHMARK_OS=YES
    BENCHMARK_SYSCALL=
    BENCHMARK_SELECT=
    BENCHMARK_SIG=
    BENCHMARK_PROC=
    BENCHMARK_CTX=
    BENCHMARK_PAGEFAULT=
    BENCHMARK_FILE=
    BENCHMARK_MMAP=
    BENCHMARK_PIPE=
    BENCHMARK_UNIX=
    BENCHMARK_UDP=
    BENCHMARK_TCP=
    BENCHMARK_CONNECT=
    BENCHMARK_RPC=
    BENCHMARK_HTTP=
    BENCHMARK_BCOPY=
    BENCHMARK_MEM=
    BENCHMARK_OPS=

四、getsummary显示数据疑问:
    1. 可能前面会发现整形、浮点等运算为什么无效?也就是没有数据。
    2. 分析getsummary源代码:
        [...省略]
                if (/SYNC_MAX/) {              -------+
                        @_ = split;                   |
                        $_[1] =~ s/]//;              |
                        push(@load, $_[1]);   --------+----------------------+
                }                                                            |
        [...省略]                                                             |
        for ($i = 0; $i <= $#uname; $i++) {                                  |
                if (&resultsq($i, $i, ( 'int64_bit', 'int64_add',            |
                                        'int64_mul', 'int64_div',            |
                                        'int64_mod' )) <= 0) {               |
                        next;                                                |
                }                                                            |
                if ($load[$i] > 1) {       <---------------------------------+
                        next; 
                }
                printf "%-9.9s %13.13s ", $host[$i], &getos($uname[$i]);
                printf " %5.5s %6.6s %6.6s %6.6s %6.6s
",
                        &scale_num($int64_bit[$i], 6, $load[$i]),
                        &scale_num($int64_add[$i], 6, $load[$i]),
                        &scale_num($int64_mul[$i], 6, $load[$i]),
                        &scale_num($int64_div[$i], 6, $load[$i]),
                        &scale_num($int64_mod[$i], 6, $load[$i]);
        }
        [...省略]
    3. 可知SYNC_MAX不能设置大于1的值,否者不会显示相应的部分。
    
原文地址:https://www.cnblogs.com/zengjfgit/p/9213926.html