code: def _build_amps_list(self, amp_value, processlist):
          
          ret = []
          try:
              # Search in both cmdline and name (for kernel thread, see #1261)
              for p in processlist:
                  add_it = False
                  if (re.search(amp_value.regex(), p['name']) is not None):
                      add_it = True
                  else:
                      for c in p['cmdline']:
                          if (re.search(amp_value.regex(), c) is not None):
                              add_it = True
                              break
                  if add_it:
                      ret.append({'pid': p['pid'],
                                  'cpu_percent': p['cpu_percent'],
                                  'memory_percent': p['memory_percent']})
  
          except (TypeError, KeyError) as e:
              logger.debug("Can not build AMPS list ({})".format(e))
  
          return ret
docs: Return the AMPS process list according to the amp_value
  
          Search application monitored processes by a regular expression