Demo entry 6324399

probe

   

Submitted by anonymous on Nov 16, 2016 at 23:31
Language: C++. Code size: 530 Bytes.

__attribute__((always_inline))
inline unsigned long probe(const char *adrs) {
  volatile unsigned long time;

  __asm__  __volatile__ (
    "  mfence             \n"
    "  lfence             \n"
    "  rdtsc              \n"
    "  lfence             \n"
    "  movl %%eax, %%esi  \n"
    "  movl (%1), %%eax   \n"
    "  lfence             \n"
    "  rdtsc              \n"
    "  subl %%esi, %%eax  \n"
    "  clflush 0(%1)      \n"
    : "=a" (time)
    : "c" (adrs)
    :  "%esi", "%edx");
  return time;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).