It would be informative to know in real-time the swap activity (number of reads and writes per minute or similar measure). I intend to use it with conky.

I can gather similar statistics by vmstat or agregate output of iotop. Unfortunately I cannot learn about the activity specifically on each swap device. The swapon command doesn't provide such answer and neither do /proc/swaps.

(I use zram swap, so the moment when swapping occurs is not immediately obvious. And since zram swap makes penalty for cpu I would like to know if it happens when I start long computations. )


I had to google the answer but the tool you need would be vmstat, example usage:

vmstat 5

Would print out data with updates every 5 seconds, change the 5 to suit to get information on the meaning of the columns of data it prints take a look at the manual page.

man vmstat

In your case it is probably si and so which will be of interest si=swap-ins and so=swap-outs, you can also view some stats including some counters since boot with with -s option.

  • Thank you. +1 for your effort. Unfortunately, AFAIK it doesn't show the swap statistics separately for each device. – Adam Ryczkowski Oct 29 '12 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.