linux查看每秒的网络流量
import os import time cmd = 'ifconfig | grep "RX bytes" | tail -1 | awk -F":" \'{print $2," ", $3}\' | awk \'{print $1 , " " , $6}\' > network_speed.temp' os.system(cmd) tx=0 rx=0 while True: file = open('network_speed.temp') for line in file: fields = line.strip().split() print time.asctime( time.localtime(time.time()) ), " " ,(int(fields[0]) - tx)/1024.0/1024.0, " ", (int(fields[1]) - rx)/1024.0/1024.0 tx = int(fields[0]) rx= int(fields[1]) time.sleep(0.1) os.system(cmd)
MySQL限时解答,24小时内友哥专业解答
http://www.yougemysqldba.com
如有进一步需要请联系微信onesoft007
微博账号@友哥一指
http://www.yougemysqldba.com
如有进一步需要请联系微信onesoft007
微博账号@友哥一指