tools/xentop: Fix cpu% sort order
In compare_cpu_pct(), there is a double -> unsigned long long converion when
calling compare(). In C, this discards the fractional part, resulting in an
out-of order sorting such as:
NAME STATE CPU(sec) CPU(%)
xendd --b--- 4020 5.7
icecream --b--- 2600 3.8
Domain-0 -----r 1060 1.5
neon --b--- 827 1.1
cheese --b--- 225 0.7
pizza --b--- 359 0.5
cassini --b--- 490 0.4
fusilli --b--- 159 0.2
bob --b--- 502 0.2
blender --b--- 121 0.2
bread --b--- 69 0.1
chickpea --b--- 67 0.1
lentil --b--- 67 0.1
Introduce compare_dbl() function and update compare_cpu_pct() to call it.
Fixes: 49839b535b78 ("Add xenstat framework.")
Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit:
e27fc7d15eab79e604e8b8728778594accc23cf1
master date: 2024-05-15 19:59:52 +0100