[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: get kernel time && data type
On Wed, Mar 14, 2001 at 06:55:05AM -0600, alejandro alliana wrote:
> I need to keep track of the time when a page is
> swapped in (out), with a presicion of about
> milliseconds or microseconds. I would like to know a
> way to get the time when that happens and what data
> type would be good for this and be reasonable easy to
> do some arithmetic operations with it.
>
> I've been using so far jiffies (unsigned long) but
> it seems the time presicion is not very good because i
> always get the same time.
Then you're doing something wrong because jiffies *is* updated every
1/HZ second and quite a lot of drivers will break if it doesn't.
> I also tried to read the
> time stamp counter (to an unsigned long long )with the
> line
> __asm__ volatile(".byte 0x0f,0x31" : "=A" (x));
> but have been having trouble with the compilation.
#include <asm/msr.h>
long t1;
rdtscl(ts);
> What other options do I have or am I on the right
> track?
Sounds to me like you're doing something wrong. I know that Adam
Wiggins used exactly the same trick with jiffies to keep track of pages
and TLB entries (for fast address space switching on StrongARM CPUs).
Erik
--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands
Phone: +31-15-2783635 Fax: +31-15-2781843 Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.surriel.com/kernelnewbies.shtml