Messages in this thread | | | Date | Sat, 12 Jun 2004 06:47:57 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: Using getpid() often, another way? [was Re: clone() <-> getpid() bug in 2.6?] |
| |
On Sat, 12 Jun 2004, Dominik Straßer wrote: > > I am facing the following problem: > I want to sum up the time spent in the main thread + all threads that > ever existed. > getrusage dosn't work (and didn't do so in pre-NPTL-times) as the time > spent in threads is not taken into account.
Hmm.. That's likely a bug. It definitely should work, but I guess the self-reaping ends up meaning that the time never gets percolated to the parent any more.
Ingo, any comments/ideas?
> To work around this problem I created a map pid->time used which used > getpid in the pre-NPTL-time and looked up the time in /proc/<pid>. As > this doesn't work with NPTL, changed it to use the gettid syscall as I > didn't find a saner way.
Changing it to gettid sounds like the right thing to do, but I also think that you shouldn't _need_ to do things like this.
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |