2013-01-17 14:50:01 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/times.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <minix/u64.h>
|
|
|
|
#include <minix/config.h>
|
|
|
|
#include <minix/const.h>
|
|
|
|
#include <minix/minlib.h>
|
|
|
|
#include <machine/archtypes.h>
|
|
|
|
|
|
|
|
#include "sysutil.h"
|
|
|
|
|
|
|
|
#ifndef CONFIG_MAX_CPUS
|
|
|
|
#define CONFIG_MAX_CPUS 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MICROHZ 1000000 /* number of micros per second */
|
|
|
|
#define MICROSPERTICK(h) (MICROHZ/(h)) /* number of micros per HZ tick */
|
|
|
|
|
2013-01-29 20:58:00 +01:00
|
|
|
static u32_t calib_hz = 600000000;
|
2013-01-17 14:50:01 +01:00
|
|
|
|
|
|
|
u32_t tsc_64_to_micros(u64_t tsc)
|
|
|
|
{
|
|
|
|
u64_t tmp;
|
|
|
|
|
2013-01-29 20:58:00 +01:00
|
|
|
tmp = tsc / calib_hz;
|
|
|
|
return (u32_t) tmp;
|
2013-01-17 14:50:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
u32_t tsc_to_micros(u32_t low, u32_t high)
|
|
|
|
{
|
|
|
|
return tsc_64_to_micros(make64(low, high));
|
|
|
|
}
|
|
|
|
|