1 2 #include <stdio.h> 3 #include <time.h> 4 #include <sys/times.h> 5 #include <sys/types.h> 6 #include <minix/u64.h> 7 #include <minix/config.h> 8 #include <minix/const.h> 9 #include <minix/minlib.h> 10 #include <machine/archtypes.h> 11 12 #include "sysutil.h" 13 14 #ifndef CONFIG_MAX_CPUS 15 #define CONFIG_MAX_CPUS 1 16 #endif 17 18 #define MICROHZ 1000000 /* number of micros per second */ 19 #define MICROSPERTICK(h) (MICROHZ/(h)) /* number of micros per HZ tick */ 20 21 static u32_t calib_hz = 600000000; 22 23 u32_t tsc_64_to_micros(u64_t tsc) 24 { 25 u64_t tmp; 26 27 tmp = tsc / calib_hz; 28 return (u32_t) tmp; 29 } 30 31 u32_t tsc_to_micros(u32_t low, u32_t high) 32 { 33 return tsc_64_to_micros(make64(low, high)); 34 } 35 36