Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jul 2000 13:11:46 -0400 (EDT)
From:      Song Li <sl5b@cs.virginia.edu>
To:        hackers@freebsd.org
Subject:   different clocks in FreeBSD
Message-ID:  <Pine.GSO.4.05.10007151248410.26368-100000@viper.cs.Virginia.EDU>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.05.10007151248410.26368-100000>