def analyse_monitoring_results(cpu_threshold, memory_threshold, outstanding_mem_polls, outstanding_procs, outstanding_procs_counter, persist_threshold):
    persist_outstanding_procs = []
    for (pid, freq) in outstanding_procs_counter.most_common():
        if (freq <= persist_threshold):
            break
        persist_outstanding_procs.append(pid)
    if (outstanding_mem_polls or persist_outstanding_procs):
        if outstanding_mem_polls:
            logging.error('system memory usage exceeds %d%%', memory_threshold)
        if persist_outstanding_procs:
            logging.error('processes that persistently exceeds cpu usage %d%%: %s', cpu_threshold, [outstanding_procs[p] for p in persist_outstanding_procs])
        pytest.fail('system cpu and memory usage check fails')
def analyse_monitoring_results(cpu_threshold, memory_threshold, outstanding_mem_polls, outstanding_procs, outstanding_procs_counter, persist_threshold):
    persist_outstanding_procs = []
    for (pid, freq) in outstanding_procs_counter.most_common():
        if (freq <= persist_threshold):
            break
        persist_outstanding_procs.append(pid)
    if (outstanding_mem_polls or persist_outstanding_procs):
        if outstanding_mem_polls:
            logging.error('system memory usage exceeds %d%%', memory_threshold)
        if persist_outstanding_procs:
            logging.error('processes that persistently exceeds cpu usage %d%%: %s', cpu_threshold, [outstanding_procs[p] for p in persist_outstanding_procs])
        pytest.fail('system cpu and memory usage check fails')