From owner-freebsd-hackers Mon Jul 17 8:24:58 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from ares.cs.Virginia.EDU (ares.cs.Virginia.EDU [128.143.137.19]) by hub.freebsd.org (Postfix) with ESMTP id 807D437B75F for ; Mon, 17 Jul 2000 08:24:35 -0700 (PDT) (envelope-from sl5b@cs.virginia.edu) Received: from viper.cs.Virginia.EDU (viper.cs.Virginia.EDU [128.143.137.17]) by ares.cs.Virginia.EDU (8.9.2/8.9.2/UVACS-2000040300) with ESMTP id LAA17316 for ; Mon, 17 Jul 2000 11:23:55 -0400 (EDT) Received: from localhost (sl5b@localhost) by viper.cs.Virginia.EDU (8.9.2/8.9.2) with ESMTP id LAA13597 for ; Mon, 17 Jul 2000 11:23:54 -0400 (EDT) X-Authentication-Warning: viper.cs.Virginia.EDU: sl5b owned process doing -bs Date: Mon, 17 Jul 2000 11:23:54 -0400 (EDT) From: Song Li To: hackers@FreeBSD.ORG Subject: Re: different clocks in FreeBSD In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Could somebody give me suggestion? I believe many people know about this question. But I did not recieve any reply until now. If you think my question is not clear or can be solve by simply reading some man page/source code, please tell me. I am a newbie here. So please do not hesitate to give me some advice. thank you all! -Song > Hey, > > I want to get the accurate user-time and system-time used by a process > whenever I want. My code will run inside the kernel. I try to use the > getrusage from within the kernel, but the function didn't give right data. > Then I try to read the p_uticks in the proc structure. But it seems that > value is not accurate enough because it will be zero when the actual user > time is small(e.g., 20microsecond). I guess it is because the frequency > of the statclock is not high enough( stathz=128 from the kern_clockrate). > So, I have the following questions: > > 1. Can I use getrusage from within the kernel to get the utime and stime? > 2. Can I use the p_uticks and p_sticks as the utime and stime of the > system? What's the meaning of p_uu and p_su? What's the meaning of the > 'tick' in the comments of these variable? Stat tick or sched tick or > anything else? > 3. If I have to change the stathz(currently 128, as reported by > kern_clockrate), where should I change in the source code? > 4. Is it possible to get the accurate utime and stime at any time, but do > not have to change the stathz(I worry about it will not efficient). I plan > to insert some code when interrupt and context switch occured. Is it > difficult? > > > thank you! > > -Song > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message