timex.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * linux/include/asm-i386/timex.h
  3. *
  4. * i386 architecture timex specifications
  5. */
  6. #ifndef _ASMi386_TIMEX_H
  7. #define _ASMi386_TIMEX_H
  8. #include <asm/processor.h>
  9. #ifdef CONFIG_X86_ELAN
  10. # define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */
  11. #else
  12. # define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
  13. #endif
  14. /*
  15. * Standard way to access the cycle counter on i586+ CPUs.
  16. * Currently only used on SMP.
  17. *
  18. * If you really have a SMP machine with i486 chips or older,
  19. * compile for that, and this will just always return zero.
  20. * That's ok, it just means that the nicer scheduling heuristics
  21. * won't work for you.
  22. *
  23. * We only use the low 32 bits, and we'd simply better make sure
  24. * that we reschedule before that wraps. Scheduling at least every
  25. * four billion cycles just basically sounds like a good idea,
  26. * regardless of how fast the machine is.
  27. */
  28. typedef unsigned long long cycles_t;
  29. static inline cycles_t get_cycles (void)
  30. {
  31. unsigned long long ret=0;
  32. #ifndef CONFIG_X86_TSC
  33. if (!cpu_has_tsc)
  34. return 0;
  35. #endif
  36. #if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
  37. rdtscll(ret);
  38. #endif
  39. return ret;
  40. }
  41. extern unsigned int cpu_khz;
  42. extern int read_current_timer(unsigned long *timer_value);
  43. #define ARCH_HAS_READ_CURRENT_TIMER 1
  44. #endif