Update patch from Juniper which converts vmstat to use libxo.
Details
Ran the following:
vmstat -a -i vmstat -f vmstat -o vmstat -m vmstat -P vmstat -a -i --libxo json | python2.7 -mjson.tool vmstat -f --libxo json | python2.7 -mjson.tool vmstat -o --libxo json | python2.7 -mjson.tool vmstat -m --libxo json | python2.7 -mjson.tool vmstat -P --libxo json | python2.7 -mjson.tool
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
vmstat.c | ||
---|---|---|
671 | xo_attr doesn't really apply to JSON so: snprintf(fmt, sizeof(fmt), "{:%s/%%ju/%%s}", name); | |
805 | %1d %1d %1d became %1d %ld %ld (one one one, became one ell ell), was that indentional? Any time the 'width' of the output is limited, you should use have an 'encoding' format version that is not limited for example: xo_emit("{:name/%16s}", string); should be: xo_emit("{:name/%s/%16s}", string, string); so the xml/json version is not truncated (or padded), but the text version is | |
822 | fixed width number | |
886 | did you mean to add a literal dollar sign here? | |
989 | you could tag the 'usec' as the units, but probably not worth it | |
1380 | %-%s is meant to have a * isn't it? |
Regarding xo_attr(), yes you are right that it applies to XML and not JSON. That part of the patch is from Juniper's original patch,
and Juniper relies more heavily on XML for some of their stuff, so I would rather leave that part of the patch in for them.