Timestamp suggestion for 2.1.x

ldoolitt@jlab.org
Thu, 22 Jan 1998 16:13:05 -0500 (EST)


At Alan's suggestion, I sketched out a generic routine
to get the time of day as accurately as possible in a
"short" amount of time. It comes out looking like this:

static void (*do_cyclecount_gettimeofday)(struct timeval *tv) = NULL;

inline void do_fast_gettimeofday(struct timeval *tv)
{
if (do_cyclecount_gettimeofday)
do_cyclecount_gettimeofday(tv);
else
*tv = xtime;
}

Where the resolution enhancement for the i386 world is then handled
in arch/i386/kernel/time.c, routine time_init(), by adding a line
do_cyclecount_gettimeofday = do_gettimeofday;
right after
do_gettimeoffset = do_fast_gettimeoffset;
Other architectures that also have this feature could make the
corresponding assignment as needed. The above inline function
itself is architecture neutral.

My patch to net/core/dev.c then should change lines from
skb->stamp=xtime;
to
do_fast_gettimeofday(&(skb->stamp));

Naturally, I haven't tested any of this. It belongs in the
2.1.x series, which I don't play with at the moment. Alan
seemed to think there were other places in the kernel that
could use this function to advantage, but he didn't tell me
where.

- Larry Doolittle <ldoolitt@jlab.org>