Date: Mon, 2 Jun 2014 14:43:23 +0300 From: Zaro Korchev <zkorchev@mail.bg> To: soc-status@freebsd.org Subject: Re: [Machine readable output from userland utilities] report Message-ID: <1AE4C0BE-546E-4B02-9664-F460F948794F@mail.bg> In-Reply-To: <8D1B686D-1AAA-4E07-9270-E42699110561@mail.bg>
index | next in thread | previous in thread | raw e-mail
This week I made some improvements to the output library libsol to allow more flexibility. I have modified the base system's versions of ls and vmstat to support the new output library. There are some things to fix but both tools can now produce JSON output. The changes are available at my GSoC svn repository: https://socsvn.freebsd.org/socsvn/soc2014/zkorchev/ At the moment both ls and vmstat are told to output JSON by specifying the -O option. However as I discussed with my mentor, this will be changed. The idea is to use an environment variable instead of the -O flag. Here are some examples of the output of vmstat (I formatted the JSON in this email to be more readable for humans): # vmstat -O { "procs_r": 0, "procs_b": 0, "procs_w": 0, "mem_avg": 541240, "mem_free": 887156, "page_flt": 15, "page_re": 0, "page_pi": 0, "page_po": 0, "page_fr": 18, "page_sr": 5, "ad0": 0, "cd0": 0, "fault_in": 2, "fault_sy": 41, "fault_cs": 61, "cpu_user": 0.09950441105699527, "cpu_sys": 1.5893235226189397, "cpu_idle": 98.31117206632406 } # vmstat -Of { "fork": { "count": 605, "pages": 23192, "average": 38.33388429752066 }, "vfork": { "count": 319, "pages": 11546, "average": 36.19435736677116 }, "rfork": { "count": 0, "pages": 0, "average": 0 } } I'm thinking about rounding the floating point numbers. Any suggestions for improvement are welcome :) Zarohelp
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1AE4C0BE-546E-4B02-9664-F460F948794F>
