I have a script which looks at the output of 'iostat -m' command. When the amount of megabytes written to a swap partition exceeds the size of the swap partition, the fragmentation effects start. I store the megabytes written in a file after reswap(swapon temp, swapoff main, swapon main, swapoff temp) and keep track of bytes written after last reswap.