mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Add get_cycles(), to be defined in asm/time.h, as a
generic method to access cpu-specific local cycle counter. Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
bde1fa0a22
commit
157a708a28
2 files changed
+12
-1
No files matched your search
+1
-1
@@ -260,7 +260,7 @@ void trace(u32 event, unsigned long d1, unsigned long d2,
|
||||
}
|
||||
|
||||
rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
|
||||
rdtscll(rec->cycles);
|
||||
rec->cycles = (u64)get_cycles();
|
||||
rec->event = event;
|
||||
rec->data[0] = d1;
|
||||
rec->data[1] = d2;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#ifndef __X86_TIME_H__
|
||||
#define __X86_TIME_H__
|
||||
|
||||
#include <asm/msr.h>
|
||||
|
||||
extern int timer_ack;
|
||||
|
||||
extern void calibrate_tsc_bp(void);
|
||||
@@ -10,4 +12,13 @@ extern void calibrate_tsc_ap(void);
|
||||
struct domain;
|
||||
extern void init_domain_time(struct domain *d);
|
||||
|
||||
typedef u64 cycles_t;
|
||||
|
||||
static inline cycles_t get_cycles(void)
|
||||
{
|
||||
cycles_t c;
|
||||
rdtscll(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /* __X86_TIME_H__ */
|
||||