Date: Tue, 15 Jan 2013 14:50:26 -0500 From: John Baldwin <jhb@freebsd.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: [PATCH] Add rusage reporting to procstat Message-ID: <201301151450.26985.jhb@freebsd.org> In-Reply-To: <20130114224442.GO2561@kib.kiev.ua> References: <201301141639.17783.jhb@freebsd.org> <20130114224442.GO2561@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, January 14, 2013 5:44:42 pm Konstantin Belousov wrote: > On Mon, Jan 14, 2013 at 04:39:17PM -0500, John Baldwin wrote: > > This patch adds a new -r flag to dump the resource usage information (what you > > would get from getrusage() or wait()) for a given process. Sample output: > > > > % procstat -r $$ > > PID COMM TYPE VALUE > > 1428 tcsh user time 00:00:00.050182 > > 1428 tcsh system time 00:00:00.040145 > > 1428 tcsh maximum RSS 3328 B > > 1428 tcsh integral shared memory 2844 B > > 1428 tcsh integral unshared data 6372 B > > 1428 tcsh integral unshared stack 1152 B > > 1428 tcsh page reclaims 1306 > > 1428 tcsh page faults 12 > > 1428 tcsh swaps 0 > > 1428 tcsh block reads 50 > > 1428 tcsh block writes 0 > > 1428 tcsh messages sent 172 > > 1428 tcsh messages received 0 > > 1428 tcsh signals received 33 > > 1428 tcsh voluntary context switches 1167 > > 1428 tcsh involuntary context switches 1 > > > > http://www.FreeBSD.org/~jhb/patches/procstat_rusage.patch > > > > Any thoughts, etc.? > > It looks fine, but use of the human-oriented resource values, together > with spaces in names, makes the parsing of the output unfeasible. Yes, but that is par for the course with procstat. If we wanted to add a global flag to request machine-readable output and update the various procstat backends to honor it, I think that would be a great project. > The patch only reports the process-cumulative rusage, and not the per-thread > rusage, it seems. Yes, this is true. It operates on the process-wide kinfo that procstat has handy. It would not be too hard to add a thread mode (-H flag perhaps?) to have it request the kinfo_proc structures for all threads and then output those separately. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301151450.26985.jhb>