Open mharsch opened 14 years ago
This is actually something that will be extremely helpful and will make this data invaluable! I would very much like to see this. There should be too much work left, since all the calculations have been figured out already.
Should be pretty easy - we just add a new flag (-r for raw perhaps) and check for that option inside print_values(). If we're in raw output mode, then we don't call prettynum().
@richardelling was working on a JSON output mode as well, but I can't remember if it was ever finished.
Other votes for this feature?
I would say a big +1 for raw
and for JSON. Key:val structure should be particularly useful today, as it will be very trivial to handle with most scripting languages.
Do not think Richard finished the JSON structure, but need to ask.
@szaydel, could I trouble you to test the change I just pushed?
Mike, thanks. Just tested, and looks good. You did not expose the -r
flag via the -v
option, but I am sure you still just testing. I might also suggest considering returning time in the seconds since epoch format, especially when doing raw output it makes sense for easy ingestion into various data crunching tools. Thanks a lot for this btw.
I've pushed the time change and also changed the headers to only print once for raw mode (agree?). Could you test these latest changes pls?
I think header printing once in raw mode is a good idea, makes perfect sense to me. Just tested, and looks like I am getting this:
# /tmp/arcstat.pl -r -f time,arcsz,l2size,c,mh%,mm%,hit%,miss%,read,hits,miss,l2hits,l2miss,dread,dhit,dmis,dh%,dm%,l2read,l2bytes,mfug,mrug 1 time arcsz l2size c mh% mm% hit% miss% read hits miss l2hits l2miss dread dhit dmis dh% dm% l2read l2bytes mfug mrug Argument "%s" isn't numeric in printf at /tmp/arcstat.pl line 259.
Looks like something with formatting. Sorry, did not look further. Thanks for making these changes, I think they will make this tool invaluable!
@szaydel I can't reproduce the above error. Could you double-check that you have the latest changes and re-test when you get a chance?
The current output of arcstat.pl is scaled in human-readable fashion. This is appropriate for human eyes watching a terminal, but doesn't lend itself to post-processing of output by another script (e.g. generating graphs). It would be nice to have a command-line switch that turns off scaling and reports all data values in raw form.