Skip to content

sadf: Fix negative fan drpm values in XML and JSON output - #469

Open
sagaragas wants to merge 1 commit into
sysstat:masterfrom
sagaragas:fix/sadf-fan-drpm
Open

sagaragas wants to merge 1 commit into
sysstat:masterfrom
sagaragas:fix/sadf-fan-drpm

Conversation

@sagaragas

Copy link
Copy Markdown
Contributor

A fan running 1000 rpm below its low limit gets drpm="18446744073709550616" in sadf -x on my x86_64 box, and the same number in sadf -j. sar -m FAN and sadf -d show -1000.00 for that sample, but the XML and JSON code casts the difference to unsigned long long.

I changed both to print it signed, which xml/sysstat.xsd already expects since drpm is an xs:integer there. Test 01560 checks the two outputs against a small data file recorded from a fake hwmon chip with a fan under its limit.

sadf -l puts the same wrong value in the PCP archive. I didn't touch that because #459 is rewriting those functions.

drpm is the difference between the fan speed and its low limit
(fan_min), so it's negative when a fan runs below that limit. sar,
"sadf -d" and "sadf -p" display it that way, e.g. -1000.00 for a fan
at 1000 rpm with a low limit of 2000 rpm. But the XML and JSON outputs
cast it to an unsigned long long, which gives
drpm="18446744073709550616" for that fan on x86_64.

Print drpm as a signed value there too. The XSD document already
defines it as an xs:integer.

Add test 01560, which uses a small data file collected with a fake
hwmon chip where fan 1 runs below its low limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant