Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2009 10:11:53 -0500
From:      Boris Kochergin <spawk@acm.poly.edu>
To:        Koffie Yahoo <koffieyahoo@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Getting running time of child
Message-ID:  <4B056039.4040802@acm.poly.edu>
In-Reply-To: <9cb658f10911190652j555e4484u2427d2bed87871f8@mail.gmail.com>
References:  <9cb658f10911190214j5a6bc17fq200a82ea0b4acaa8@mail.gmail.com>	<86ocmy63ww.fsf@ds4.des.no> <9cb658f10911190652j555e4484u2427d2bed87871f8@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Koffie Yahoo wrote:
>>> I've looked but not found (and I hope I'm in the right group here): Is
>>> there a way to get the user time and system time of a /running/ child
>>> from its parent (without having to mount procfs)?
>>>       
>> If you have only one child, there's getrusage(2).
>>     
>
> Unfortunately, that only works for children that have terminated, not
> for active children. I'm interested in active children.
>
> Jay
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>   
It's not as portable as getrusage(2), but you could probably get the 
information you want using libkvm's kvm_getprocs(3) function. The 
information available is defined in the kinfo_proc structure in 
/usr/include/sys/user.h.

-Boris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B056039.4040802>