Back to index

glibc  2.9
Defines | Typedefs
hp-timing.h File Reference
#include <string.h>
#include <sys/param.h>
#include <stdio-common/_itoa.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define HP_TIMING_AVAIL   (1)
#define HP_TIMING_INLINE   (1)
#define HP_TIMING_ZERO(Var)   (Var) = (0)
#define HP_TIMING_NOW(Var)   __asm__ __volatile__ ("rdtsc" : "=A" (Var))
#define HP_TIMING_DIFF_INIT()
#define HP_TIMING_DIFF(Diff, Start, End)   (Diff) = ((End) - (Start))
#define HP_TIMING_ACCUM(Sum, Diff)
#define HP_TIMING_ACCUM_NT(Sum, Diff)   (Sum) += (Diff)
#define HP_TIMING_PRINT(Buf, Len, Val)

Typedefs

typedef unsigned long long int hp_timing_t

Define Documentation

#define HP_TIMING_ACCUM (   Sum,
  Diff 
)
Value:
do {                                                                 \
    int __not_done;                                                  \
    hp_timing_t __oldval = (Sum);                                    \
    hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead);              \
    do                                                               \
      {                                                                     \
	hp_timing_t __newval = __oldval + __diff;                           \
       int __temp0, __temp1;                                                \
       __asm__ __volatile__ ("xchgl %0, %%ebx\n\t"                          \
                           "lock; cmpxchg8b %1\n\t"                         \
                           "sete %%bl\n\t"                                  \
                           "xchgl %0, %%ebx"                                \
                           : "=SD" (__not_done), "=m" (Sum),                \
                            "=A" (__oldval), "=c" (__temp0)                 \
                           : "m" (Sum), "2" (__oldval),              \
                            "3" ((unsigned int) (__newval >> 32)),          \
                            "0" ((unsigned int) __newval));                 \
      }                                                                     \
    while ((unsigned char) __not_done);                                     \
  } while (0)

Definition at line 120 of file hp-timing.h.

#define HP_TIMING_ACCUM_NT (   Sum,
  Diff 
)    (Sum) += (Diff)

Definition at line 143 of file hp-timing.h.

#define HP_TIMING_AVAIL   (1)

Definition at line 79 of file hp-timing.h.

#define HP_TIMING_DIFF (   Diff,
  Start,
  End 
)    (Diff) = ((End) - (Start))

Definition at line 117 of file hp-timing.h.

#define HP_TIMING_DIFF_INIT ( )
Value:
do {                                                                 \
    if (GLRO(dl_hp_timing_overhead) == 0)                            \
      {                                                                     \
       int __cnt = 5;                                                       \
       GLRO(dl_hp_timing_overhead) = ~0ull;                                 \
       do                                                            \
         {                                                           \
	    hp_timing_t __t1, __t2;                                         \
           HP_TIMING_NOW (__t1);                                     \
           HP_TIMING_NOW (__t2);                                     \
           if (__t2 - __t1 < GLRO(dl_hp_timing_overhead))                   \
             GLRO(dl_hp_timing_overhead) = __t2 - __t1;              \
         }                                                           \
       while (--__cnt > 0);                                          \
      }                                                                     \
  } while (0)

Definition at line 98 of file hp-timing.h.

#define HP_TIMING_INLINE   (1)

Definition at line 82 of file hp-timing.h.

#define HP_TIMING_NOW (   Var)    __asm__ __volatile__ ("rdtsc" : "=A" (Var))

Definition at line 95 of file hp-timing.h.

#define HP_TIMING_PRINT (   Buf,
  Len,
  Val 
)
Value:
do {                                                                 \
    char __buf[20];                                                  \
    char *__cp = _itoa (Val, __buf + sizeof (__buf), 10, 0);                \
    size_t __len = (Len);                                            \
    char *__dest = (Buf);                                            \
    while (__len-- > 0 && __cp < __buf + sizeof (__buf))                    \
      *__dest++ = *__cp++;                                           \
    memcpy (__dest, " clock cycles", MIN (__len, sizeof (" clock cycles")));  \
  } while (0)

Definition at line 146 of file hp-timing.h.

#define HP_TIMING_ZERO (   Var)    (Var) = (0)

Definition at line 88 of file hp-timing.h.


Typedef Documentation

typedef unsigned long long int hp_timing_t

Definition at line 85 of file hp-timing.h.