开启辅助访问 切换到窄版

打印 上一主题 下一主题

linux性能统计命令

[复制链接]
作者:丁r 
版块:
嵌入式操作系统 linux 发布时间:2021-3-13 20:43:04
12410
楼主
跳转到指定楼层
| 只看该作者 回帖奖励 |倒序浏览 |阅读模式
性能压力测试,yes持续输出30s到设备中空文件,然后杀掉进程
{ yes> /dev/null & } && sleep 30 && ps -ef|grep yes | awk '{print $2}'| xargs kill

30s进程被杀掉
查看统计服务器cpu核心数
命令2根据cpu核心数循环插入
for i in $(seq 0 $(($(cat /proc/cpuinfo |grep processor |wc -l)-1))); do taskset -c $i yes >/dev/null & done && sleep 30 && ps -ef |grep yes| awk '{print $2}' |xargs kill
语法解析
for 变量名 in 列表
do
程序段(command)
for i in $(seq 0 $(($(cat /proc/cpuinfo |grep processor |wc -l)-1))); ==根据核心数遍历4次 do taskset -c $i yes >/dev/null & done && sleep 30 && ps -ef |grep yes| awk '{print $2}' |xargs kill

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表