ia64/xen-unstable

view tools/misc/cpuperf/cpuperf_perfcntr.h @ 3963:cfee4c4a8ed6

bitkeeper revision 1.1242 (4225f56fwo6ym-RMTBheAeYhl10ATQ)

forward ported James Bulpin's performance counters tool

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author rneugeba@wyvis.research.intel-research.net
date Wed Mar 02 17:18:39 2005 +0000 (2005-03-02)
parents
children
line source
1 /*
2 * Interface to JRB44's /proc/perfcntr interface.
3 *
4 * $Id: cpuperf_perfcntr.h,v 1.1 2003/10/13 16:49:44 jrb44 Exp $
5 *
6 * $Log: cpuperf_perfcntr.h,v $
7 * Revision 1.1 2003/10/13 16:49:44 jrb44
8 * Initial revision
9 *
10 */
12 #define PROC_PERFCNTR "/proc/perfcntr"
14 static inline void perfcntr_wrmsr(int cpu_mask,
15 int msr,
16 unsigned int low,
17 unsigned int high )
18 {
19 FILE *fd;
20 unsigned long long value = low | (((unsigned long long)high) << 32);
22 fd = fopen(PROC_PERFCNTR, "w");
23 if (fd == NULL)
24 {
25 perror("open " PROC_PERFCNTR);
26 exit(1);
27 }
29 fprintf(fd, "%x %x %llx \n", cpu_mask, msr, value);
30 fprintf(stderr, "%x %x %llx \n", cpu_mask, msr, value);
31 fclose(fd);
32 }
34 static inline unsigned long long perfcntr_rdmsr( int cpu_mask, int msr )
35 {
36 fprintf(stderr, "WARNING: rdmsr not yet implemented for perfcntr.\n");
37 return 0;
38 }
40 // End of $RCSfile: cpuperf_perfcntr.h,v $