summaryrefslogtreecommitdiff
path: root/kernel/arch/i386/tsc.c
blob: a4f3c3f40a1b5d4b9553d58bcde9de22b91faf94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <arch/i386/tsc.h>

u64 cpu_mhz = 0;
u64 tsc_get_hz(void);

void tsc_init(void) {
  cpu_mhz = tsc_get_hz() / 10000;
}

u64 tsc_get_mhz() {
  return cpu_mhz;
}

u64 tsc_calculate_ms(u64 tsc) {
  return tsc / (cpu_mhz * 1000);
}