Date: Wed, 18 Nov 2009 13:12:33 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: cronfy <cronfy@sprinthost.ru> Cc: FreeBSD <freebsd-questions@freebsd.org> Subject: Re: get accounting info for running process Message-ID: <20091118191233.GC89004@dan.emsphone.com> In-Reply-To: <4B042C50.6060904@sprinthost.ru> References: <4B042C50.6060904@sprinthost.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Nov 18), cronfy said: > Is it possible to find out how much a process have used CPU user > time/system time/IO operations for now by it's pid? Like in sa, but for > running process. It's available to userland programs via the kern.proc.all syscall. it returns an array of "struct kinfo_proc", one for each process. One of the elements is ki_rusage, which contains the data that the sa command uses. The ps command can easily be extended to print these fields. See this patch at http://lists.freebsd.org/pipermail/freebsd-hackers/2009-March/027918.html for an example. (I still need to file that PR...) -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091118191233.GC89004>