def test_cpu_times_percent_per_cpu(compare_cpu_times, flush): t1 = P.cpu_times(1) # We need a delay of at least a second here to get close readings for both the APIs psutil_times_percent = psutil.cpu_times_percent(1, True) pslib_times_percent = P.cpu_times_percent(1, t1) for i,psutil_measure in enumerate(psutil_times_percent): pslib_measure = pslib_times_percent[i] assert compare_cpu_times(pslib_measure, psutil_measure)
def test_cpu_times_percent_per_cpu(compare_cpu_times, flush): t1 = P.cpu_times(1) # We need a delay of at least a second here to get close readings for both the APIs psutil_times_percent = psutil.cpu_times_percent(1, True) pslib_times_percent = P.cpu_times_percent(1, t1) for i, psutil_measure in enumerate(psutil_times_percent): pslib_measure = pslib_times_percent[i] assert compare_cpu_times(pslib_measure, psutil_measure)
def test_cpu_times_percent(compare_cpu_times, flush): t1 = P.cpu_times(0) # We need a delay of at least a second here to get close readings for both the APIs psutil_times_percent = psutil.cpu_times_percent(1) pslib_times_percent = P.cpu_times_percent(0, t1) compare_cpu_times(psutil_times_percent, pslib_times_percent)