From owner-freebsd-threads@FreeBSD.ORG Thu Apr 19 09:57:36 2012 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26C361065674 for ; Thu, 19 Apr 2012 09:57:36 +0000 (UTC) (envelope-from chris.hall@highwayman.com) Received: from anchor-post-1.mail.demon.net (anchor-post-1.mail.demon.net [195.173.77.132]) by mx1.freebsd.org (Postfix) with ESMTP id DBB7F8FC0A for ; Thu, 19 Apr 2012 09:57:35 +0000 (UTC) Received: from [80.177.246.130] (helo=hestia.halldom.com) by anchor-post-1.mail.demon.net with esmtp (Exim 4.69) id 1SKo7F-00012i-gI for freebsd-threads@freebsd.org; Thu, 19 Apr 2012 09:57:29 +0000 Received: from hyperion.halldom.com ([80.177.246.170] helo=HYPERION) by hestia.halldom.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1SKo7E-0002IG-Oa for freebsd-threads@freebsd.org; Thu, 19 Apr 2012 09:57:28 +0000 From: "'Chris Hall'" Sender: "Chris Hall" To: Date: Thu, 19 Apr 2012 10:57:23 +0100 Organization: Highwayman Message-ID: <03d901cd1e12$d4720820$7d561860$@highwayman.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: Ac0eEs3ADNTAl0LdSq2y/1AthFmIwg== Content-Language: en-gb Subject: pthread_getcpuclockid() not quite what I expected X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2012 09:57:36 -0000 I use pthread_getcpuclockid() in a "watch-dog" pthread to one side of a pthreaded application. With FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 the result is a little disappointing. The clock_id returned is the same for all thread_ids, and is CLOCK_THREAD_CPUTIME_ID. So, instead of reading the cpu time for each pthread, clock_gettime() in the watch-dog pthread reads its own cpu time :-( This is not quite what POSIX lead me to hope for. Is there something more modern I should be using ? Chris -- Chris Hall, Highwayman