WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] forward ported James Bulpin's performance counters tool

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] forward ported James Bulpin's performance counters tool
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 02 Mar 2005 17:18:39 +0000
Delivery-date: Tue, 05 Apr 2005 16:06:27 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1242, 2005/03/02 17:18:39+00:00, 
rneugeba@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

        forward ported James Bulpin's performance counters tool
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 libxc/xc.h                      |    5 
 libxc/xc_misc.c                 |   33 +
 misc/Makefile                   |    3 
 misc/cpuperf/Makefile           |   51 ++
 misc/cpuperf/README.txt         |  371 ++++++++++++++++++++
 misc/cpuperf/cpuperf.c          |  301 ++++++++++++++++
 misc/cpuperf/cpuperf_perfcntr.h |   41 ++
 misc/cpuperf/cpuperf_xeno.h     |   38 ++
 misc/cpuperf/module/Makefile    |   16 
 misc/cpuperf/module/perfcntr.c  |  730 ++++++++++++++++++++++++++++++++++++++++
 misc/cpuperf/p4perf.h           |  382 ++++++++++++++++++++
 11 files changed, 1971 insertions(+)


diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h
--- a/tools/libxc/xc.h  2005-04-05 12:06:31 -04:00
+++ b/tools/libxc/xc.h  2005-04-05 12:06:31 -04:00
@@ -370,6 +370,11 @@
                      u32 op,
                      xc_perfc_desc_t *desc);
 
+/* read/write msr */
+long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
+int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
+                  unsigned int high);
+
 /**
  * Memory maps a range within one domain to a local address range.  Mappings
  * should be unmapped with munmap and should follow the same rules as mmap
diff -Nru a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
--- a/tools/libxc/xc_misc.c     2005-04-05 12:06:31 -04:00
+++ b/tools/libxc/xc_misc.c     2005-04-05 12:06:31 -04:00
@@ -97,3 +97,36 @@
 
     return (rc == 0) ? dop.u.perfccontrol.nr_counters : rc;
 }
+
+long long xc_msr_read(int xc_handle, int cpu_mask, int msr)
+{
+    int rc;    
+    dom0_op_t op;
+    
+    op.cmd = DOM0_MSR;
+    op.u.msr.write = 0;
+    op.u.msr.msr = msr;
+    op.u.msr.cpu_mask = cpu_mask;
+
+    rc = do_dom0_op(xc_handle, &op);
+
+    return (((unsigned long long)op.u.msr.out2)<<32) | op.u.msr.out1 ;
+}
+
+int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
+                  unsigned int high)
+{
+    int rc;    
+    dom0_op_t op;
+    
+    op.cmd = DOM0_MSR;
+    op.u.msr.write = 1;
+    op.u.msr.msr = msr;
+    op.u.msr.cpu_mask = cpu_mask;
+    op.u.msr.in1 = low;
+    op.u.msr.in2 = high;
+
+    rc = do_dom0_op(xc_handle, &op);
+    
+    return rc;
+}
diff -Nru a/tools/misc/Makefile b/tools/misc/Makefile
--- a/tools/misc/Makefile       2005-04-05 12:06:31 -04:00
+++ b/tools/misc/Makefile       2005-04-05 12:06:31 -04:00
@@ -21,18 +21,21 @@
 
 all: $(TARGETS)
        $(MAKE) -C miniterm
+       $(MAKE) -C cpuperf
 
 install: all
        [ -d $(DESTDIR)/usr/bin ] || $(INSTALL_DIR) $(DESTDIR)/usr/bin
        [ -d $(DESTDIR)/usr/sbin ] || $(INSTALL_DIR) $(DESTDIR)/usr/sbin
        $(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
        $(INSTALL_PROG) $(INSTALL_SBIN) $(DESTDIR)/usr/sbin
+       $(MAKE) -C cpuperf install
 #       No sense in installing miniterm on the Xen box.
 #      $(MAKE) -C miniterm install
 
 clean:
        $(RM) *.o $(TARGETS) *~
        $(MAKE) -C miniterm clean
+       $(MAKE) -C cpuperf clean
 
 %.o: %.c $(HDRS) Makefile
        $(CC) -c $(CFLAGS) -o $@ $<
diff -Nru a/tools/misc/cpuperf/Makefile b/tools/misc/cpuperf/Makefile
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/tools/misc/cpuperf/Makefile       2005-04-05 12:06:31 -04:00
@@ -0,0 +1,51 @@
+#
+# Make Performance counter tool
+#
+# $Id: Makefile,v 1.1 2003/10/13 16:49:44 jrb44 Exp $
+#
+# $Log: Makefile,v $
+# Revision 1.1  2003/10/13 16:49:44  jrb44
+# Initial revision
+#
+#
+
+INSTALL                = install
+INSTALL_PROG   = $(INSTALL) -m0755
+INSTALL_DIR    = $(INSTALL) -d -m0755
+
+# these are for Xen
+XEN_ROOT=../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+CC           = gcc
+CFLAGS       = -Wall -O3 
+
+HDRS         = $(wildcard *.h)
+SRCS         = $(wildcard *.c)
+OBJS         = $(patsubst %.c,%.o,$(SRCS))
+
+TARGETS      = cpuperf-xen cpuperf-perfcntr
+
+INSTALL_BIN  = $(TARGETS)
+
+
+all: $(TARGETS)
+
+clean:
+       $(RM) *.o $(TARGETS)
+
+%: %.c $(HDRS) Makefile
+       $(CC) $(CFLAGS) -o $@ $<
+
+cpuperf-xen: cpuperf.c $(HDRS) Makefile
+       $(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxc -L$(XEN_LIBXUTIL) 
-lxutil -DXENO -o $@ $<
+
+cpuperf-perfcntr: cpuperf.c $(HDRS) Makefile
+       $(CC) $(CFLAGS) -DPERFCNTR -o $@ $<
+
+install: all
+       $(INSTALL_PROG) $(INSTALL_BIN) $(DESTDIR)/usr/bin
+
+
+# End of $RCSfile: Makefile,v $
+
diff -Nru a/tools/misc/cpuperf/README.txt b/tools/misc/cpuperf/README.txt
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/tools/misc/cpuperf/README.txt     2005-04-05 12:06:31 -04:00
@@ -0,0 +1,371 @@
+Usage
+=====
+
+Use either xen-cpuperf, cpuperf-perfcntr as appropriate to the system
+in use.
+
+To write:
+
+    cpuperf -E <escr> -C <cccr> 
+
+        optional: all numbers in base 10 unless specified
+
+        -d             Debug mode
+        -c <cpu>       CPU number
+        -t <thread>    ESCR thread bits - default is 12 (Thread 0 all rings)
+                         bit 0: Thread 1 in rings 1,2,3
+                         bit 1: Thread 1 in ring 0
+                         bit 2: Thread 0 in rings 1,2,3
+                         bit 3: Thread 0 in ring 0
+        -e <eventsel>  Event selection number
+        -m <eventmask> Event mask bits
+        -T <value>     ESCR tag value
+        -k             Sets CCCR 'compare' bit
+        -n             Sets CCCR 'complement' bit
+        -g             Sets CCCR 'edge' bit
+        -P <bit>       Set the specified bit in MSR_P4_PEBS_ENABLE
+        -V <bit>       Set the specified bit in MSR_P4_PEBS_MATRIX_VERT
+        (-V and -P may be used multiple times to set multiple bits.)
+
+To read:
+
+    cpuperf -r    
+
+        optional: all numbers in base 10 unless specified
+    
+        -c <cpu>       CPU number
+
+<cccr> values:
+
+    BPU_CCCR0
+    BPU_CCCR1
+    BPU_CCCR2
+    BPU_CCCR3
+    MS_CCCR0
+    MS_CCCR1
+    MS_CCCR2
+    MS_CCCR3
+    FLAME_CCCR0
+    FLAME_CCCR1
+    FLAME_CCCR2
+    FLAME_CCCR3
+    IQ_CCCR0
+    IQ_CCCR1
+    IQ_CCCR2
+    IQ_CCCR3
+    IQ_CCCR4
+    IQ_CCCR5
+    NONE - do not program any CCCR, used when setting up an ESCR for tagging
+
+<escr> values:
+
+    BSU_ESCR0
+    BSU_ESCR1
+    FSB_ESCR0
+    FSB_ESCR1
+    MOB_ESCR0
+    MOB_ESCR1
+    PMH_ESCR0
+    PMH_ESCR1
+    BPU_ESCR0
+    BPU_ESCR1
+    IS_ESCR0
+    IS_ESCR1
+    ITLB_ESCR0
+    ITLB_ESCR1
+    IX_ESCR0
+    IX_ESCR1
+    MS_ESCR0
+    MS_ESCR1
+    TBPU_ESCR0
+    TBPU_ESCR1
+    TC_ESCR0
+    TC_ESCR1
+    FIRM_ESCR0
+    FIRM_ESCR1
+    FLAME_ESCR0
+    FLAME_ESCR1
+    DAC_ESCR0
+    DAC_ESCR1
+    SAAT_ESCR0
+    SAAT_ESCR1
+    U2L_ESCR0
+    U2L_ESCR1
+    CRU_ESCR0
+    CRU_ESCR1
+    CRU_ESCR2
+    CRU_ESCR3
+    CRU_ESCR4
+    CRU_ESCR5
+    IQ_ESCR0
+    IQ_ESCR1
+    RAT_ESCR0
+    RAT_ESCR1
+    SSU_ESCR0
+    SSU_ESCR1
+    ALF_ESCR0
+    ALF_ESCR1
+
+
+Example configurations
+======================

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] forward ported James Bulpin's performance counters tool, BitKeeper Bot <=