Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
Multicore clock counter consistency

I am trying to measure a difference of clock counters between two time points at a kernel module. I use the following function named get_ccnt() to get a clock counter value at a certain time:

static __inline__ long long int get_ccnt(void)
{
    #if defined(__i386__)
        long long int x;
        __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
        return x;

    #elif defined(__x86_64__)
        unsigned int hi, lo;
        __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
        return ( (long long int)lo)|( ((long long int)hi)<<32 );

    #endif
}

What I concern is, I am using HP EliteBook 2530p in which Intel Core 2 Duo SL9400 (spec. reference)

I heard that CPUs after Nehalem has a consistent clock counter over all cores. (If I get wrong, please point it out.) But, Intel Core 2 Duo SL 9400 has a code name Penryn.

Thus, I think if a kernel module moves from one core to another between two time points, then consistency between two cores is compromised and I can't get a right clock difference.

Is it right what I am thinking? If it is, is there a way to fix it (e.g. fix a kernel module not to move a core to a core?)

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

One of the comments linked mentions that setting the process affinity can achieve what you want. I would also suggest making a custom version of get_ccnt() whereby replacing RDTSC with RDTSCP. The latter is a variant of the former which also returns the cpuid with the cycle counter. You could check that your initial measurement's cpuid is equal to the final measurement's cpuid.

Have a look at Section 3.2 of this Intel manual. Be sure to make a test first to verify that your processor supports this instruction.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda