def FindPerformanceAttributesByName(instanceName, object=None, counter=None, format=win32pdh.PDH_FMT_LONG, machine=None, bRefresh=0):
 if (object is None):
  object = find_pdh_counter_localized_name('Process', machine)
 if (counter is None):
  counter = find_pdh_counter_localized_name('ID Process', machine)
 if bRefresh:
  win32pdh.EnumObjects(None, machine, 0, 1)
 instanceName = instanceName.lower()
 (items, instances) = win32pdh.EnumObjectItems(None, None, object, (-1))
 instance_dict = {}
 for instance in instances:
  try:
   instance_dict[instance] = (instance_dict[instance] + 1)
  except KeyError:
   instance_dict[instance] = 0
 ret = []
 for (instance, max_instances) in instance_dict.iteritems():
  for inum in xrange((max_instances + 1)):
   if (instance.lower() == instanceName):
    ret.append(GetPerformanceAttributes(object, counter, instance, inum, format, machine))
 return ret

def FindPerformanceAttributesByName ( instanceName , object = None , counter = None , format = win32pdh . PDH_FMT_LONG , machine = None , bRefresh = 0 ) : if ( object is None ) : object = find_pdh_counter_localized_name ( 'Process' , machine ) if ( counter is None ) : counter = find_pdh_counter_localized_name ( 'ID Process' , machine ) if bRefresh : win32pdh . EnumObjects ( None , machine , 0 , 1 ) instanceName = instanceName . lower ( ) ( items , instances ) = win32pdh . EnumObjectItems ( None , None , object , ( - 1 ) ) instance_dict = { } for instance in instances : try : instance_dict [ instance ] = ( instance_dict [ instance ] + 1 ) except KeyError : instance_dict [ instance ] = 0 ret = [ ] for ( instance , max_instances ) in instance_dict . iteritems ( ) : for inum in xrange ( ( max_instances + 1 ) ) : if ( instance . lower ( ) == instanceName ) : ret . append ( GetPerformanceAttributes ( object , counter , instance , inum , format , machine ) ) return ret
find peformance attributes by instance name .