[lkml]   [2004]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: 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.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2009-11-18 23:46    [W:0.066 / U:9.192 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site