view TaskManager/Fifo/rdtsc.h @ 1964:33d07fd99291 draft

fix CudaScheduler
author kkb
date Wed, 12 Feb 2014 18:15:10 +0900
parents 7673e2ad2623
children
line wrap: on
line source

#ifndef RDTSC_H_
#define RDTSC_H_

/*
 *  rdtsc is Read Time Stamp Counter
 */

/* define this somewhere */
#ifdef __i386
__inline__ uint64_t rdtsc() {
    uint64_t x;
    __asm__ volatile ("rdtsc" : "=A" (x));
    return x;
}
#elif __amd64
__inline__ uint64_t rdtsc() {
    uint64_t a, d;
    __asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
    return (d<<32) | a;
}
#endif
#endif