Re: [PATCH] Add rusage reporting to procstat

2013-01-15 Thread Slawa Olhovchenkov
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

maximum RSS -- 3328 _bytes_? You kidding.

  1428 tcsh integral shared memory   2844 B
  1428 tcsh integral unshared data   6372 B
  1428 tcsh integral unshared stack  1152 B
  1428 tcsh page reclaims1306  
  1428 tcsh page faults12  
  1428 tcsh swaps   0  
  1428 tcsh block reads50  
  1428 tcsh block writes0  
  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 switches1  
 
 http://www.FreeBSD.org/~jhb/patches/procstat_rusage.patch
 
 Any thoughts, etc.?
 
 -- 
 John Baldwin
 ___
 freebsd-current@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-current
 To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: [PATCH] Add rusage reporting to procstat

2013-01-15 Thread Slawa Olhovchenkov
On Tue, Jan 15, 2013 at 01:49:01PM +, David Chisnall wrote:

 On 15 Jan 2013, at 13:47, Slawa Olhovchenkov wrote:
 
  maximum RSS -- 3328 _bytes_? You kidding.
 
 I think this is a bug in our getrusage.  I've seen similar (4KB)
 things in a program that mmap()s 12KB of input, allocates a load of
 heap memory for metadata, uses a bunch of stack, and then exits.  


 I find it is quite odd that the figure isn't a multiple of the page
 size, because the resident set can't be anything other than an
 integer number of pages..

man getrusage

 ru_maxrssthe maximum resident set size utilized (in kilobytes).

Dimensions of the other fields may be also wrong.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: [PATCH] Add rusage reporting to procstat

2013-01-15 Thread John Baldwin
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 reclaims1306  
   1428 tcsh page faults12  
   1428 tcsh swaps   0  
   1428 tcsh block reads50  
   1428 tcsh block writes0  
   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 switches1  
  
  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
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


[PATCH] Add rusage reporting to procstat

2013-01-14 Thread John Baldwin
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 reclaims1306  
 1428 tcsh page faults12  
 1428 tcsh swaps   0  
 1428 tcsh block reads50  
 1428 tcsh block writes0  
 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 switches1  

http://www.FreeBSD.org/~jhb/patches/procstat_rusage.patch

Any thoughts, etc.?

-- 
John Baldwin
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: [PATCH] Add rusage reporting to procstat

2013-01-14 Thread Konstantin Belousov
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 reclaims1306  
  1428 tcsh page faults12  
  1428 tcsh swaps   0  
  1428 tcsh block reads50  
  1428 tcsh block writes0  
  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 switches1  
 
 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.

The patch only reports the process-cumulative rusage, and not the per-thread
rusage, it seems.


pgpw48106d1Rd.pgp
Description: PGP signature