arcstat icon indicating copy to clipboard operation
arcstat copied to clipboard

need script-parsable output mode with non-scaled values

Open mharsch opened this issue 13 years ago • 8 comments

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.

mharsch avatar Oct 25 '10 16:10 mharsch

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.

szaydel avatar May 11 '12 14:05 szaydel

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?

mharsch avatar May 11 '12 21:05 mharsch

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 avatar May 11 '12 21:05 szaydel

@szaydel, could I trouble you to test the change I just pushed?

mharsch avatar May 11 '12 21:05 mharsch

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.

szaydel avatar May 11 '12 21:05 szaydel

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?

mharsch avatar May 11 '12 22:05 mharsch

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 avatar May 11 '12 23:05 szaydel

@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?

mharsch avatar May 19 '12 15:05 mharsch