Repository navigation
Commit ebe9bb4
sysinfo.pl 1.2.3: fix memory used/free swapped in display and percent
memoryusage() computed $vard as actual used memory (Total - Free -
Buffers - Cached), but the final return statement treated it as if it
were free memory: it displayed human_size($vara-$vard) as "used" and
computed the percentage as 100-($vard/($vara-$vard)*100).
This mislabeled free memory as used in the output, and produced a
negative percentage whenever used memory exceeded free memory (e.g.
'2.83GB/7.57GB (-67.52%)' on a host where 4.74GB was actually in use).
Fix by using $vard directly as used memory in both the display and the
percentage calculation.1 parent 962b42b commit ebe9bb4
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | | - | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| |||
884 | 888 | | |
885 | 889 | | |
886 | 890 | | |
887 | | - | |
888 | | - | |
| 891 | + | |
| 892 | + | |
889 | 893 | | |
890 | 894 | | |
891 | 895 | | |
| |||
0 commit comments