17 lines
343 B
Bash
Raw Normal View History

2015-02-19 20:15:38 +01:00
#!/bin/sh
2015-02-21 18:18:27 +01:00
if is_osx; then
2015-02-22 18:36:04 +01:00
collect () {
report $(sysctl -n vm.swapusage |
awk '{ if (int($3) == 0) exit; printf "%.1f", $6 / $3 * 100.0 }')
2015-02-22 18:36:04 +01:00
}
else
collect () {
report $(free |
awk '/Swap/{ if (int($2) == 0) exit; printf "%.1f", $3 / $2 * 100.0 }')
2015-02-22 18:36:04 +01:00
}
fi
docs () {
echo "Percentage of used swap space."
}