rusage and pthreads

2011-01-18 Thread Mark Terribile
Hi, I'm trying to figure out the interactions between rusage and pthreads. Peeking around in the kernel (7.2) I see updates occurring in various places. kern_clock.c, for instance, appears to increment the memory occupancy (*rss) counters. This would make it appear that every thread gets

Re: rusage and pthreads

2011-01-18 Thread Chuck Swiger
On Jan 18, 2011, at 4:07 PM, Mark Terribile wrote: I'm trying to figure out the interactions between rusage and pthreads. There largely isn't any-- struct rusage is per-process, not per thread. Peeking around in the kernel (7.2) I see updates occurring in various places. kern_clock.c

Re: rusage and pthreads

2011-01-18 Thread Mark Terribile
Chuck, I'm trying to figure out the interactions between rusage and pthreads. There largely isn't any-- struct rusage is per-process, not per thread. Peeking around in the kernel (7.2) I see updates occurring in various places.  kern_clock.c, for instance, appears to increment

Re: rusage and pthreads

2011-01-18 Thread Mark Terribile
Chuck, I forgot to add: Nope.  statclock() is fired off periodically (with some fuzz, to avoid clever games by processes trying to avoid being sampled) to update the stats for the currently running process. Which would mean that a process that is occupying memory but doesn't happen to be

Re: rusage and pthreads

2011-01-18 Thread Chuck Swiger
On Jan 18, 2011, at 5:01 PM, Mark Terribile wrote: and continues further down ru = td-td_ru; ru-ru_ixrss += pgtok(vm-vm_tsize); ru-ru_idrss += pgtok(vm-vm_dsize); ru-ru_isrss += pgtok(vm-vm_ssize); This looks to me like it's accumulating the data in per-thread