meminfo shows data like these:
MemTotal: 30524188 kB
MemFree: 3695720 kB
MemAvailable: 20690088 kB
...
In bytesize::ByteSize::from_str, they will be parsed as KB(source of Unit::from_str, called in ByteSize::from_str).
impl str::FromStr for Unit {
// ...
fn from_str(unit: &str) -> Result<Self, Self::Err> {
match () {
// ...
_ if unit.eq_ignore_ascii_case("k") | unit.eq_ignore_ascii_case("kb") => {
Ok(Self::KiloByte)
}
// ...
}
}
}
Anyway, it is formatted in KiB instead of KB. Or rather, kB has always been KiB. But bytesize ignored cases(eq_ignore_ascii_case).
See sources of Linux kernel here
static void show_val_kb(struct seq_file *m, const char *s, unsigned long num)
{
seq_put_decimal_ull_width(m, s, num << (PAGE_SHIFT - 10), 8);
seq_write(m, " kB\n", 4);
}
Thanks for @Franklin-Qi to mentiond it in #389
meminfoshows data like these:In
bytesize::ByteSize::from_str, they will be parsed as KB(source of Unit::from_str, called in ByteSize::from_str).Anyway, it is formatted in
KiBinstead ofKB. Or rather,kBhas always beenKiB. But bytesize ignored cases(eq_ignore_ascii_case).See sources of Linux kernel here
Thanks for @Franklin-Qi to mentiond it in #389