def net_io_counters():
 with open_text(('%s/net/dev' % get_procfs_path())) as f:
  lines = f.readlines()
 retdict = {}
 for line in lines[2:]:
  colon = line.rfind(':')
  assert (colon > 0), repr(line)
  name = line[:colon].strip()
  fields = line[(colon + 1):].strip().split()
  (bytes_recv, packets_recv, errin, dropin, fifoin, framein, compressedin, multicastin, bytes_sent, packets_sent, errout, dropout, fifoout, collisionsout, carrierout, compressedout) = map(int, fields)
  retdict[name] = (bytes_sent, bytes_recv, packets_sent, packets_recv, errin, errout, dropin, dropout)
 return retdict

def net_io_counters ( ) : with open_text ( ( '%s/net/dev' % get_procfs_path ( ) ) ) as f : lines = f . readlines ( ) retdict = { } for line in lines [ 2 : ] : colon = line . rfind ( ':' ) assert ( colon > 0 ) , repr ( line ) name = line [ : colon ] . strip ( ) fields = line [ ( colon + 1 ) : ] . strip ( ) . split ( ) ( bytes_recv , packets_recv , errin , dropin , fifoin , framein , compressedin , multicastin , bytes_sent , packets_sent , errout , dropout , fifoout , collisionsout , carrierout , compressedout ) = map ( int , fields ) retdict [ name ] = ( bytes_sent , bytes_recv , packets_sent , packets_recv , errin , errout , dropin , dropout ) return retdict
return network i/o statistics for every network interface installed on the system as a dict of raw tuples .