Skip to contentSkip to conversation

64-bit jiffies, a better solution

DISCUSSION Jim Houston 2 participants 2 messages May 11, 2002

lore
Share & tools
lore
#0 lore raw

Hi!

First what problem are you trying to solve? Why not have both variables and if they happen to endup in the same cache line you probably need years worth of jiffies to notice how long one more add takes. E.g.

	jiffies_64++;
	jiffies++;

To round out the list of options, how about a few lines of inline asm? Maybe something like:

   extern unsigned long long jiffie_64;
   extern unsigned int jiffie;
   __asm__ (" \
        .data
        .align  8
        .global jiffie
        .global jiffie_64
        .type   jiffie,@object
        .size   jiffie,4
        .type   jiffie_64,@object
        .size   jiffie_64,8
   jiffie_64:
   jiffie:
        .long   0, 0
   ");

Adding the obvious ifdef of course. Aside for broken binutils this might be portable code :-)

Jim Houston - Concurrent Computer
Corp.

#1 lore raw
Quoted 31 lines · Jim Houston

Hi!

First what problem are you trying to solve? Why not have both variables and if they happen to endup in the same cache line you probably need years worth of jiffies to notice how long one more add takes. E.g.

        jiffies_64++;
        jiffies++;

To round out the list of options, how about a few lines of inline asm? Maybe something like:

   extern unsigned long long jiffie_64;
   extern unsigned int jiffie;
   __asm__ (" \
        .data
        .align  8
        .global jiffie
        .global jiffie_64
        .type   jiffie,@object
        .size   jiffie,4
        .type   jiffie_64,@object
        .size   jiffie_64,8
   jiffie_64:
   jiffie:
        .long   0, 0
   ");
Quoted 2 lines

Adding the obvious ifdef of course. Aside for broken binutils this might be portable code :-)

Until you move to a big endian 32-bit machine. I would much rather hear IS portable.

Signature · 4 lines
George Anzinger   [email protected]
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Real time sched:  http://sourceforge.net/projects/rtsched/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml