def system_load(pl, format=u'{avg:.1f}', threshold_good=1, threshold_bad=2, track_cpu_count=False, short=False):
 global cpu_count
 try:
  cpu_num = cpu_count = (_cpu_count() if ((cpu_count is None) or track_cpu_count) else cpu_count)
 except NotImplementedError:
  pl.warn(u'Unable to get CPU count: method is not implemented')
  return None
 ret = []
 for avg in os.getloadavg():
  normalized = (avg / cpu_num)
  if (normalized < threshold_good):
   gradient_level = 0
  elif (normalized < threshold_bad):
   gradient_level = (((normalized - threshold_good) * 100.0) / (threshold_bad - threshold_good))
  else:
   gradient_level = 100
  ret.append({u'contents': format.format(avg=avg), u'highlight_groups': [u'system_load_gradient', u'system_load'], u'divider_highlight_group': u'background:divider', u'gradient_level': gradient_level})
  if short:
   return ret
 ret[0][u'contents'] += u' '
 ret[1][u'contents'] += u' '
 return ret

def system_load ( pl , format = u'{avg:.1f}' , threshold_good = 1 , threshold_bad = 2 , track_cpu_count = False , short = False ) : global cpu_count try : cpu_num = cpu_count = ( _cpu_count ( ) if ( ( cpu_count is None ) or track_cpu_count ) else cpu_count ) except NotImplementedError : pl . warn ( u'Unable to get CPU count: method is not implemented' ) return None ret = [ ] for avg in os . getloadavg ( ) : normalized = ( avg / cpu_num ) if ( normalized < threshold_good ) : gradient_level = 0 elif ( normalized < threshold_bad ) : gradient_level = ( ( ( normalized - threshold_good ) * 100.0 ) / ( threshold_bad - threshold_good ) ) else : gradient_level = 100 ret . append ( { u'contents' : format . format ( avg = avg ) , u'highlight_groups' : [ u'system_load_gradient' , u'system_load' ] , u'divider_highlight_group' : u'background:divider' , u'gradient_level' : gradient_level } ) if short : return ret ret [ 0 ] [ u'contents' ] += u' ' ret [ 1 ] [ u'contents' ] += u' ' return ret
return system load average .