From owner-freebsd-hackers Sat Jul 15 10:11:50 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from ares.cs.Virginia.EDU (ares.cs.Virginia.EDU [128.143.136.41]) by hub.freebsd.org (Postfix) with ESMTP id EF5F437BC9F for ; Sat, 15 Jul 2000 10:11:47 -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 NAA16542 for ; Sat, 15 Jul 2000 13:11:46 -0400 (EDT) Received: from localhost (sl5b@localhost) by viper.cs.Virginia.EDU (8.9.2/8.9.2) with ESMTP id NAA26557 for ; Sat, 15 Jul 2000 13:11:46 -0400 (EDT) X-Authentication-Warning: viper.cs.Virginia.EDU: sl5b owned process doing -bs Date: Sat, 15 Jul 2000 13:11:46 -0400 (EDT) From: Song Li To: hackers@freebsd.org Subject: different clocks in FreeBSD 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 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