ldomctl(8) 'status' updated the value only on running guests,
i.e. stopped ones repeated the last ones instead of showing zero.
Always reset per guest before updating it, From Koakuma, thanks!
-/* $OpenBSD: ldomctl.c,v 1.40 2021/10/24 21:24:18 deraadt Exp $ */
+/* $OpenBSD: ldomctl.c,v 1.41 2023/08/10 07:50:45 kn Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
if (nbytes != sizeof(msg))
err(1, "read");
+ utilisation = 0.0;
+
memcpy(&state, msg.msg.resstat.data, sizeof(state));
switch (state.state) {
case GUEST_STATE_STOPPED:
if (yielded_cycles <= total_cycles)
utilisation = (100.0 * (total_cycles
- yielded_cycles)) / total_cycles;
- else
- utilisation = 0.0;
break;
case GUEST_STATE_SUSPENDED: