小宝--读书笔记
zieckey
全部博文(176)
PHP(1)
Class Design Pri(5)
Design Patterns(21)
Arithmetic Data (21)
职业生涯(1)
其它(0)
音乐电影(0)
生活(1)
修身养性(0)
搞笑(1)
OpenGL(6)
gcc-gdb(2)
socket-net(12)
进程控制(1)
pthread(11)
E680(3)
Win32 C/C++(3)
Standard C/C++(35)
Linux C/C++(15)
QT Embedded(0)
Command(6)
Kernel(1)
Solaris(0)
Other(0)
Install && Usage(0)
Soft Install && (2)
J2EE(2)
J2SE(5)
J2ME(5)
2012年(1)
2011年(4)
2010年(14)
2009年(71)
2008年(103)
Tay_linu
北国飘雪
zouyoupe
zhbnx
妤傛ê鍋
wb123456
dnybz
wanfengc
毋纵年华
aoxuestu
cynthia
Bsolar
王Wangmy
along819
分类: LINUX
2010-08-26 19:01:25
#!/bin/bash if [ -n "$1" ]; then eth_name=$1 else eth_name="eth0" fi i=0 send_o=`ifconfig $eth_name | grep bytes | awk '{print $6}' | awk -F : '{print $2}'` recv_o=`ifconfig $eth_name | grep bytes | awk '{print $2}' | awk -F : '{print $2}'` send_n=$send_o recv_n=$recv_o while [ $i -le 100000 ]; do send_l=$send_n recv_l=$recv_n sleep 1 send_n=`ifconfig $eth_name | grep bytes | awk '{print $6}' | awk -F : '{print $2}'` recv_n=`ifconfig $eth_name | grep bytes | awk '{print $2}' | awk -F : '{print $2}'` i=`expr $i + 1` send_r=`expr $send_n - $send_l` recv_r=`expr $recv_n - $recv_l` total_r=`expr $send_r + $recv_r` send_ra=`expr \( $send_n - $send_o \) / $i` recv_ra=`expr \( $recv_n - $recv_o \) / $i` total_ra=`expr $send_ra + $recv_ra` sendn=`ifconfig $eth_name | grep bytes | awk -F \( '{print $3}' | awk -F \) '{print $1}'` recvn=`ifconfig $eth_name | grep bytes | awk -F \( '{print $2}' | awk -F \) '{print $1}'` clear echo "Last second : Send rate: $send_r Bytes/sec Recv rate: $recv_r Bytes/sec Total rate: $total_r Bytes/sec" echo "Average value: Send rate: $send_ra Bytes/sec Recv rate: $recv_ra Bytes/sec Total rate: $total_ra Bytes/sec" echo "Total traffic after startup: Send traffic: $sendn Recv traffic: $recvn" done
上一篇:netperf
下一篇:一句话解说内存屏障 Memory barrier
chinaunix网友2010-08-29 15:53:21
Download More than 1000 free IT eBooks: http://free-ebooks.appspot.com
登录 注册