From: Roland McGrath <roland@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Chris Friesen <cfriesen@nortel.com>,
LKML <linux-kernel@vger.kernel.org>,
Ulrich Drepper <drepper@redhat.com>
Subject: Re: linux missing support for _POSIX_THREAD_CPUTIME?
Date: Wed, 27 May 2009 10:49:53 -0700 (PDT) [thread overview]
Message-ID: <20090527174954.085AAFC36B@magilla.sf.frob.com> (raw)
In-Reply-To: Thomas Gleixner's message of Wednesday, 27 May 2009 18:56:15 +0200 <alpine.LFD.2.00.0905271855290.3397@localhost.localdomain>
> 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
next prev parent reply other threads:[~2009-05-27 17:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 16:46 Chris Friesen
2009-05-27 16:56 ` Thomas Gleixner
2009-05-27 17:14 ` Chris Friesen
2009-05-27 17:36 ` Thomas Gleixner
2009-05-27 20:00 ` Chris Friesen
2009-05-27 17:49 ` Roland McGrath [this message]
2009-05-27 17:00 ` linux missing support for _POSIX_THREAD_CPUTIME ? Chris Friesen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090527174954.085AAFC36B@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=cfriesen@nortel.com \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®