timex.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * linux/include/asm-x86_64/timex.h
  3. *
  4. * x86-64 architecture timex specifications
  5. */
  6. #ifndef _ASMx8664_TIMEX_H
  7. #define _ASMx8664_TIMEX_H
  8. #include <asm/8253pit.h>
  9. #include <asm/msr.h>
  10. #include <asm/vsyscall.h>
  11. #include <asm/hpet.h>
  12. #include <asm/system.h>
  13. #include <asm/processor.h>
  14. #include <linux/compiler.h>
  15. #define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */
  16. typedef unsigned long long cycles_t;
  17. static inline cycles_t get_cycles (void)
  18. {
  19. unsigned long long ret;
  20. rdtscll(ret);
  21. return ret;
  22. }
  23. /* Like get_cycles, but make sure the CPU is synchronized. */
  24. static __always_inline cycles_t get_cycles_sync(void)
  25. {
  26. unsigned long long ret;
  27. unsigned eax;
  28. /* Don't do an additional sync on CPUs where we know
  29. RDTSC is already synchronous. */
  30. alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
  31. "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
  32. rdtscll(ret);
  33. return ret;
  34. }
  35. extern unsigned int cpu_khz;
  36. extern int read_current_timer(unsigned long *timer_value);
  37. #define ARCH_HAS_READ_CURRENT_TIMER 1
  38. extern struct vxtime_data vxtime;
  39. #endif