Date: Mon, 20 Nov 1995 13:51:25 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: Andres.Vega_Garcia@sophia.inria.fr (Andres Vega Garcia) Cc: hackers@FreeBSD.org Subject: Re: Notion of time in kernel + malloc Message-ID: <199511202051.NAA01979@phaeton.artisoft.com> In-Reply-To: <199511201935.UAA16241@fun.inria.fr> from "Andres Vega Garcia" at Nov 20, 95 08:35:33 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> Hello, I'm adding some code to the kernel in order to modify the > packet scheduling policy (currently FIFO) to Fair Queueing, and I > need to have a notion of time (seconds (or tens of seconds) elapsed > since ...). > > => Can I use just gettimeofday?, or there is a better way? > (The #ifdef in sys/time.h disables the prototype for gettimeofday > when KERNEL is defined) Look at /sys/ufs/ufs/ufs_vnops.c. Probably accessing the global timeval struct "time" is the correct way to do what you want with the least expense. It should be good to 10ms, at least. Actually, note that SMP and portability concerns should drive this to be macroed at some time in the future, so don't overuse it. [ ... ] Your malloc code is not happy. Grep for malloc in /sys/kern/* for better examples of its use. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511202051.NAA01979>