Example #1
0
def test_cpu_util_percent_per_cpu(almost_equal, 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_util_percent = psutil.cpu_percent(1, True)
    pslib_util_percent = P.cpu_util_percent(1, t1)
    for i,v in enumerate(psutil_util_percent):
        assert almost_equal(v, pslib_util_percent[i])
Example #2
0
def test_cpu_util_percent_per_cpu(almost_equal, 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_util_percent = psutil.cpu_percent(1, True)
    pslib_util_percent = P.cpu_util_percent(1, t1)
    for i, v in enumerate(psutil_util_percent):
        assert almost_equal(v, pslib_util_percent[i])
Example #3
0
def test_cpu_util_percent(almost_equal, 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_util_percent = psutil.cpu_percent(1)
    pslib_util_percent = P.cpu_util_percent(0, t1)
    assert almost_equal(psutil_util_percent, pslib_util_percent[0])
Example #4
0
def test_cpu_util_percent(almost_equal, 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_util_percent = psutil.cpu_percent(1)
    pslib_util_percent = P.cpu_util_percent(0, t1)
    assert almost_equal(psutil_util_percent, pslib_util_percent[0])