From owner-freebsd-threads@FreeBSD.ORG Fri Feb 18 16:56:05 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2076816A4CE; Fri, 18 Feb 2005 16:56:05 +0000 (GMT) Received: from mx.highway.ne.jp (pip8.usen.ad.jp [61.122.117.246]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17F4D43D1F; Fri, 18 Feb 2005 16:56:04 +0000 (GMT) (envelope-from kaakun@highway.ne.jp) Received: from [219.195.104.17] (helo=[192.168.11.16]) by pop11.isp.us-com.jp with esmtp (Mail 4.20) id 1D2BQ9-0004zt-JF; Sat, 19 Feb 2005 01:56:01 +0900 Message-ID: <42161DFE.70701@highway.ne.jp> Date: Sat, 19 Feb 2005 01:55:26 +0900 From: Kazuaki Oda User-Agent: Mozilla Thunderbird 1.0 (X11/20050101) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: threads@freebsd.org Subject: Re: thread accounting in libpthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Feb 2005 16:56:05 -0000 Daniel Eischen wrote: >On Fri, 18 Feb 2005, Kazuaki Oda wrote: > > > >>Hi, >> >>thr_accounting function (libpthread/thread/thr_kern.c) calculates >>thread->slice_usec, and it uses tm_uticks, tm_sticks and _clock_res_usec. >>I think that kernel counts up tm_uticks and tm_sticks at statclock interrupt >>time, and on -CURRENT _clock_res_usec is 1000 and on 5-STABLE it is 10000. >> >>Does thr_accounting calculate thread->slice_usec correctly? >> >> > >I just fixed this. It didn't really affect anything, though, since >it's all relative. You could have used any bogus number for the >resolution of a tick. > > > Thanks. And while looking at thr_kern.c, I've had one more question. In kse_switchout_thread, after calling thr_accounting thread is placed at the tail of run queue or at the head of it according to thread->slice_usec. But in kse_check_completed, thread is just placed at the tail of run queue. Is there any reason why thread is not placed at the head of run queue in case of thread->slice_usec != -1? -------------------- Kazuaki Oda