While the system was doing about 100k syscalls per second, "systat -vmstat 1" showed "0.1" in the "Sys" column. IIUC, the problem happens between 100k to 1M, between 100M to 1G, etc, for any field formatted with this function.
Details
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
usr.bin/systat/vmstat.c | ||
---|---|---|
666 | Here "w" is the maximum width of the field in characters. humanize_number() expects available buffer space as its second argument. Not including an extra byte for the NUL leaves only space for 3 characters and causes humanize_number() to fallback to trying to format in decimal due to lack of space (but there isn't enough space for the suffix then). There's plenty of space in "buf" for the NUL, so just add 1 to "w". |
There are other problems with systat -vmstat as we talked about on IRC. I'm going to create another diff and add you guys as reviewers if you don't mind. I'm sure that this patch is correct after spending more time with it and it's very small so I'll leave it as is to not lose it. The other changes might be more problematic.