Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / include / arch-x86_64 / tsc.h
1 /*
2  * linux/include/asm-i386/tsc.h
3  *
4  * i386 TSC related functions
5  */
6 #ifndef _ARCH_x86_64_TSC_H
7 #define _ARCH_x86_64_TSC_H
8
9 #include <lwk/types.h>
10 #include <arch/processor.h>
11
12 typedef uint64_t cycles_t;
13
14 /**
15  * Returns the current value of the CPU's cycle counter.
16  *
17  * NOTE: This is not serializing. It doesn't necessarily wait for previous
18  *       instructions to complete before reading the cycle counter. Also,
19  *       subsequent instructions could potentially begin execution before
20  *       the cycle counter is read.
21  */
22 static __always_inline cycles_t
23 get_cycles(void)
24 {
25         cycles_t ret = 0;
26         rdtscll(ret);
27         return ret;
28 }
29
30 /**
31  * This is a synchronizing version of get_cycles(). It ensures that all
32  * previous instructions have completed before reading the cycle counter.
33  */
34 static __always_inline cycles_t
35 get_cycles_sync(void)
36 {
37         sync_core();
38         return get_cycles();
39 }
40
41 #endif