view TaskManager/Fifo/rdtsc.h @ 2022:fac44ad2867d draft

make a sound
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Wed, 16 Jul 2014 02:50:32 +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