def cpuload():
 cmd = list2cmdline(['wmic', 'cpu'])
 info = __salt__['cmd.run'](cmd).split('\r\n')
 column = info[0].index('LoadPercentage')
 end = info[1].index(' ', (column + 1))
 return int(info[1][column:end])

def cpuload ( ) : cmd = list2cmdline ( [ 'wmic' , 'cpu' ] ) info = __salt__ [ 'cmd.run' ] ( cmd ) . split ( '\r\n' ) column = info [ 0 ] . index ( 'LoadPercentage' ) end = info [ 1 ] . index ( ' ' , ( column + 1 ) ) return int ( info [ 1 ] [ column : end ] )
calculate average cpu usage .