custom message type for VM_INFO
[minix3.git] / lib / libsys / arch / earm / tsc_util.c
blob4f973e9a16cc6f43bc832ee197c4c107782b4a9a
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>
12 #include "sysutil.h"
14 #ifndef CONFIG_MAX_CPUS
15 #define CONFIG_MAX_CPUS 1
16 #endif
18 #define MICROHZ 1000000 /* number of micros per second */
19 #define MICROSPERTICK(h) (MICROHZ/(h)) /* number of micros per HZ tick */
21 static u32_t calib_hz = 600000000;
23 u32_t tsc_64_to_micros(u64_t tsc)
25 u64_t tmp;
27 tmp = tsc / calib_hz;
28 return (u32_t) tmp;
31 u32_t tsc_to_micros(u32_t low, u32_t high)
33 return tsc_64_to_micros(make64(low, high));