• Linux下使用lookbusy加载cpu负载


    Lookbusy 是一个用于在 Linux 系统上生成合成负载的简单应用程序。它可以在 CPU 上生成固定的、可预测的负载,保持选定数量的内存处于活动状态,并生成您需要的任意数量的磁盘流量。

    官方地址:lookbusy -- a synthetic load generator

    编译

    arm编译

    1. ./configure --host=arm-linux-gnueabihf LDFLAGS=-static  # --host指定gcc版本,LDFLAGS指定静态编译
    2. make
    3. make install

    x86编译

    1. ./configure
    2. make
    3. make install

    使用

    官方指令

    1. usage: lookbusy [ -h ] [ options ]
    2. General options:
    3. -h, --help Commandline help (you're reading it)
    4. -v, --verbose Verbose output (may be repeated)
    5. -q, --quiet Be quiet, produce output on errors only
    6. CPU usage options:
    7. -c, --cpu-util=PCT, Desired utilization of each CPU, in percent (default
    8. --cpu-util=RANGE 50%). If 'curve' CPU usage mode is chosen, a range
    9. of the form MIN-MAX should be given.
    10. -n, --ncpus=NUM Number of CPUs to keep busy (default: autodetected)
    11. -r, --cpu-mode=MODE Utilization mode ('fixed' or 'curve', see lookbusy(1))
    12. -p, --cpu-curve-peak=TIME
    13. Offset of peak utilization within curve period, in
    14. seconds (append 'm', 'h', 'd' for other units)
    15. -P, --cpu-curve-period=TIME
    16. Duration of utilization curve period, in seconds (append
    17. 'm', 'h', 'd' for other units)
    18. Memory usage options:
    19. -m, --mem-util=SIZE Amount of memory to use (in bytes, followed by KB, MB,
    20. or GB for other units; see lookbusy(1))
    21. -M, --mem-sleep=TIME Time to sleep between iterations, in usec (default 1000)
    22. Disk usage options:
    23. -d, --disk-util=SIZE Size of files to use for disk churn (in bytes,
    24. followed by KB, MB, GB or TB for other units)
    25. -b, --disk-block-size=SIZE
    26. Size of blocks to use for I/O (in bytes, followed
    27. by KB, MB or GB)
    28. -D, --disk-sleep=TIME
    29. Time to sleep between iterations, in msec (default 100)
    30. -f, --disk-path=PATH Path to a file/directory to use as a buffer (default
    31. /tmp); specify multiple times for additional paths
    1. lookbusy -c 60 # 占用所有 CPU 核心各 60%
    2. lookbusy -c 50 -n 2 # 占用两个 CPU 核心各 50%
    3. lookbusy -c 50-80 -r curve # 占用所有 CPU 核心在 50%-80% 左右浮动
    4. l

    效果

  • 相关阅读:
    zookeeper连接客户端操作数据时报错Socket is not connected
    Linux:ll命令详解
    【笔试刷题训练】day_12
    Android---GC回收机制与分代回收策略
    计算机组成原理 new09 定点数的移位运算
    Springboot旅游攻略平台2de9n计算机毕业设计-课程设计-期末作业-毕设程序代做
    数据分析笔试题(二)
    力扣(566.303)补8.25
    vueX持久化存储插件
    关于项目的相关测试
  • 原文地址:https://blog.csdn.net/misterdo/article/details/132827186