def get_load_per_cpu(_stats=None):
 stats = []
 f_stat = open('/proc/stat', 'r')
 if _stats:
  for i in range(len(_stats)):
   stats.append((int(f_stat.readline().split()[1]) - _stats[i]))
 else:
  line = f_stat.readline()
  while line:
   if line.startswith('cpu'):
    stats.append(int(line.split()[1]))
   else:
    break
   line = f_stat.readline()
 return stats

def get_load_per_cpu ( _stats = None ) : stats = [ ] f_stat = open ( '/proc/stat' , 'r' ) if _stats : for i in range ( len ( _stats ) ) : stats . append ( ( int ( f_stat . readline ( ) . split ( ) [ 1 ] ) - _stats [ i ] ) ) else : line = f_stat . readline ( ) while line : if line . startswith ( 'cpu' ) : stats . append ( int ( line . split ( ) [ 1 ] ) ) else : break line = f_stat . readline ( ) return stats
gather load per cpu from /proc/stat .