CPU user/kernel time given the PID

2009-03-08 Thread Jay Loden
I'm working on FreeBSD support for a Python library called psutil for reading process information in a cross-platform fashion. Each platform-specific module is written in C, so the majority of the FreeBSD code is a C interface to various process information. I've been having some trouble working

Re: CPU user/kernel time given the PID

2009-03-08 Thread Jay Loden
Oliver Fromme wrote: ps(1) and top(1) both use ki_pctcpu, see the getpcpu() function in src/bin/ps/print.c and format_next_process() in src/usr.bin/top/machine.c Hi Oliver, thanks for the reply. I noticed the same after some digging through the source code for ps and top. While CPU usage % is

Re: CPU user/kernel time given the PID

2009-03-09 Thread Jay Loden
Dan Nelson wrote: I was wondering why you were having so much trouble finding what you were looking for, and then I realized I have a patch that I have never submitted a PR for: the addition of systime and usertime ps keywords :) It simply reads the rusage struct, and returns the same values