[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090527174954.085AAFC36B@magilla.sf.frob.com>
Date: Wed, 27 May 2009 10:49:53 -0700 (PDT)
From: Roland McGrath <roland@...hat.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Chris Friesen <cfriesen@...tel.com>,
LKML <linux-kernel@...r.kernel.org>,
Ulrich Drepper <drepper@...hat.com>
Subject: Re: linux missing support for _POSIX_THREAD_CPUTIME?
> POSIX defines optional support for clock ID values obtained by invoking
> pthread_getcpuclockid(). When passed to clock_gettime(), this allows
> the caller to request the CPU-time clock of an arbitrary thread within
> the same process as the caller.
>
> It appears that linux doesn't support this functionality--is that
> correct? Is there any plan to enable this?
glibc does implement pthread_getcpuclockid using the kernel support for it.
It uses MAKE_THREAD_CPUCLOCK(tid, CPUCLOCK_SCHED) (see linux/posix-timers.h).
> Is there any current way to obtain the runtime of a particular thread
> without knowing its tid (since the thread_id to tid mapping is known
> only to glibc)?
You need a tid to construct the clock ID with MAKE_THREAD_CPUCLOCK().
The pthread_getcpuclockid function exists to do this for you when you are
using pthreads. If you are not using pthreads, then certainly you have to
figure out what a thread's tid is yourself.
Thanks,
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists