Linux:如何获取进程使用的交换?

时间:2013-05-24 14:06:56

标签: linux memory

获取常驻设置大小很简单(getrusage()/proc/self/statm),但如何获得交换量?从man 5 proc关于/ proc / self / stat:

nswap %lu   Number of pages swapped (not maintained).

cnswap %lu  Cumulative nswap for child processes (not maintained).

还有其他想法吗?

1 个答案:

答案 0 :(得分:2)

检查VmSwap中是否有/proc/$PROCESS/status。例如:grep VmSwap /proc/1/status