diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 201878f134..11176de738 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -1560,7 +1560,7 @@ PsutilMethods[] = { {"disk_usage", psutil_disk_usage, METH_VARARGS}, {"getloadavg", (PyCFunction)psutil_get_loadavg, METH_VARARGS}, {"getpagesize", psutil_getpagesize, METH_VARARGS}, - {"getpercentswap", (PyCFunction)psutil_swap_percent, METH_VARARGS}, + {"swap_percent", psutil_swap_percent, METH_VARARGS}, {"init_loadavg_counter", (PyCFunction)psutil_init_loadavg_counter, METH_VARARGS}, {"net_connections", psutil_net_connections, METH_VARARGS}, {"net_if_addrs", psutil_net_if_addrs, METH_VARARGS}, diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index 15c356944f..4081aa17fb 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -254,12 +254,12 @@ def swap_memory(): # pages are accessed, so we can't use free system memory for swap. # instead, we calculate page file usage based on performance counter if (total > 0): - percentswap = cext.getpercentswap() + percentswap = cext.swap_percent() used = int(0.01 * percentswap * total) else: used = 0 free = total - used - percent = usage_percent(used, total, round_=1) + percent = round(percentswap, 1) return _common.sswap(total, used, free, percent, 0, 0)