码迷,mamicode.com
首页 > 其他好文 > 详细

cpu-io.sh

时间:2017-08-10 01:16:58      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:model   echo   dev   fda   swa   print   gre   org   syn   

CPU-IO.SH

#!/bin/bash
#Edit by laozuo.org

cname=$(cat /proc/cpuinfo|grep name|head -1|awk ‘{ $1=$2=$3=""; print }‘)
cores=$(cat /proc/cpuinfo|grep MHz|wc -l)
freq=$(cat /proc/cpuinfo|grep MHz|head -1|awk ‘{ print $4 }‘)
tram=$(free -m | awk ‘NR==2‘|awk ‘{ print $2 }‘)
swap=$(free -m | awk ‘NR==4‘| awk ‘{ print $2 }‘)
up=$(uptime|awk ‘{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }‘)
cache=$((wget -O /dev/null http://cachefly.cachefly.net/100mb.test) 2>&1 | tail -2 | head -1 | awk ‘{print $3 $4 }‘)
io=$( (dd if=/dev/zero of=test_$$ bs=64k count=16k conv=fdatasync &&rm -f test_$$) 2>&1 | tail -1| awk ‘{ print $(NF-1) $NF }‘)
echo "CPU model : $cname"
echo "Number of cores : $cores"
echo "CPU frequency : $freq MHz"
echo "Total amount of ram : $tram MB"
echo "Total amount of swap : $swap MB"
echo "System uptime : $up"
echo "Download speed : $cache "
echo "I/O speed : $io"

  

cpu-io.sh

标签:model   echo   dev   fda   swa   print   gre   org   syn   

原文地址:http://www.cnblogs.com/crac/p/7336941.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!