direct-io.hg

changeset 7584:f1b6dd997716

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>
author kaf24@firebug.cl.cam.ac.uk
date Tue Nov 01 10:28:41 2005 +0100 (2005-11-01)
parents 6be0d21bb863
children a48ac90f99f1
files xen/common/trace.c xen/include/asm-x86/time.h
line diff
     1.1 --- a/xen/common/trace.c	Mon Oct 31 17:14:59 2005 +0100
     1.2 +++ b/xen/common/trace.c	Tue Nov 01 10:28:41 2005 +0100
     1.3 @@ -260,7 +260,7 @@ void trace(u32 event, unsigned long d1, 
     1.4      }
     1.5  
     1.6      rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
     1.7 -    rdtscll(rec->cycles);
     1.8 +    rec->cycles  = (u64)get_cycles();
     1.9      rec->event   = event;
    1.10      rec->data[0] = d1;
    1.11      rec->data[1] = d2;
     2.1 --- a/xen/include/asm-x86/time.h	Mon Oct 31 17:14:59 2005 +0100
     2.2 +++ b/xen/include/asm-x86/time.h	Tue Nov 01 10:28:41 2005 +0100
     2.3 @@ -2,6 +2,8 @@
     2.4  #ifndef __X86_TIME_H__
     2.5  #define __X86_TIME_H__
     2.6  
     2.7 +#include <asm/msr.h>
     2.8 +
     2.9  extern int timer_ack;
    2.10  
    2.11  extern void calibrate_tsc_bp(void);
    2.12 @@ -10,4 +12,13 @@ extern void calibrate_tsc_ap(void);
    2.13  struct domain;
    2.14  extern void init_domain_time(struct domain *d);
    2.15  
    2.16 +typedef u64 cycles_t;
    2.17 +
    2.18 +static inline cycles_t get_cycles(void)
    2.19 +{
    2.20 +    cycles_t c;
    2.21 +    rdtscll(c);
    2.22 +    return c;
    2.23 +}
    2.24 +
    2.25  #endif /* __X86_TIME_H__ */