Open flxo opened 3 years ago
Describe the bug
Parsing the stats of the blkio controller is broken. According to [1], section IO Interface Files the io.stat file has the format:
IO Interface Files
io.stat
8:16 rbytes=1459200 wbytes=314773504 rios=192 wios=35 8:0 rbytes=90430464 wbytes=299008000 rios=8950 wios=1252
but the parsing code expects a : instead of a = in blk.rs
:
=
Expected behavior
Parse the correct values.
Additional context
The implementation could be easily optimised to avoid the String and Vec allocations by modifying get_value:
String
Vec
get_value
fn get_value(s: &str) -> u64 { s.split('=') .skip(1) .next() .and_then(|s| s.parse::<u64>().ok()) .unwrap_or_default() }
which is only used for the v2 parsing. Same applies for more places of the parsing code in (at least) blkio.
[1] https://www.kernel.org/doc/Documentation/cgroup-v2.txt
@liubin PTAL
Hello,
This issues is open for quite a long time. Anything I can support here in order to make progress?
Thanks,
@flxo
Hi @c3d, you assigned to yourself, do you plan to fix this issue?
Describe the bug
Parsing the stats of the blkio controller is broken. According to [1], section
IO Interface Files
theio.stat
file has the format:but the parsing code expects a
:
instead of a=
in blk.rsExpected behavior
Parse the correct values.
Additional context
The implementation could be easily optimised to avoid the
String
andVec
allocations by modifyingget_value
:which is only used for the v2 parsing. Same applies for more places of the parsing code in (at least) blkio.
[1] https://www.kernel.org/doc/Documentation/cgroup-v2.txt