mirror of
https://git.yoctoproject.org/poky
synced 2026-02-20 08:29:42 +01:00
oprofile: Add opstart/opstop commands, fix armv6 events file
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2822 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
54
meta/packages/oprofile/oprofile/armv6_fix.patch
Normal file
54
meta/packages/oprofile/oprofile/armv6_fix.patch
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
events/arm/armv6/events | 43 +++++++++++++++++++++----------------------
|
||||
1 file changed, 21 insertions(+), 22 deletions(-)
|
||||
|
||||
Index: oprofile-0.9.3/events/arm/armv6/events
|
||||
===================================================================
|
||||
--- oprofile-0.9.3.orig/events/arm/armv6/events 2007-07-16 19:22:17.000000000 +0100
|
||||
+++ oprofile-0.9.3/events/arm/armv6/events 2007-09-28 11:13:32.000000000 +0100
|
||||
@@ -1,24 +1,23 @@
|
||||
# ARM V6 events
|
||||
#
|
||||
-event:0x00 counters:1,2 um:zero minimum:500 name:IFU_IFETCH_MISS : number of instruction fetch misses
|
||||
-event:0x01 counters:1,2 um:zero minimum:500 name:CYCLES_IFU_MEM_STALL : cycles instruction fetch pipe is stalled
|
||||
-event:0x02 counters:1,2 um:zero minimum:500 name:CYCLES_DATA_STALL : cycles stall occurs for due to data dependency
|
||||
-event:0x03 counters:1,2 um:zero minimum:500 name:ITLB_MISS : number of Instruction MicroTLB misses
|
||||
-event:0x04 counters:1,2 um:zero minimum:500 name:DTLB_MISS : number of Data MicroTLB misses
|
||||
-event:0x05 counters:1,2 um:zero minimum:500 name:BR_INST_EXECUTED : branch instruction executed w/ or w/o program flow change
|
||||
-event:0x06 counters:1,2 um:zero minimum:500 name:BR_INST_MISS_PRED : branch mispredicted
|
||||
-event:0x07 counters:1,2 um:zero minimum:500 name:INSN_EXECUTED : instructions executed
|
||||
-event:0x09 counters:1,2 um:zero minimum:500 name:DCACHE_ACCESS : data cache access, cacheable locations
|
||||
-event:0x0a counters:1,2 um:zero minimum:500 name:DCACHE_ACCESS_ALL : data cache access, all locations
|
||||
-event:0x0b counters:1,2 um:zero minimum:500 name:DCACHE_MISS : data cache miss
|
||||
-event:0x0c counters:1,2 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline
|
||||
-event:0x0d counters:1,2 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch
|
||||
-event:0x0f counters:1,2 um:zero minimum:500 name:TLB_MISS : Main TLB miss
|
||||
-event:0x10 counters:1,2 um:zero minimum:500 name:EXP_EXTERNAL : Explict external data access
|
||||
-event:0x11 counters:1,2 um:zero minimum:500 name:LSU_STALL : cycles stalled because Load Store request queque is full
|
||||
-event:0x12 counters:1,2 um:zero minimum:500 name:WRITE_DRAIN : Times write buffer was drained
|
||||
-event:0x20 counters:1,2 um:zero minimum:500 name:ETMEXTOUT0 : nuber of cycles ETMEXTOUT[0] signal was asserted
|
||||
-event:0x21 counters:1,2 um:zero minimum:500 name:ETMEXTOUT1 : nuber of cycles ETMEXTOUT[1] signal was asserted
|
||||
-event:0x22 counters:1,2 um:zero minimum:500 name:ETMEXTOUT_BOTH : nuber of cycles both ETMEXTOUT [0] and [1] were asserted * 2
|
||||
-event:0xff counters:1,2 um:zero minimum:500 name:CPU_CYCLES2 : clock cycles counter
|
||||
-event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
|
||||
+event:0x00 counters:0,1 um:zero minimum:500 name:IFU_IFETCH_MISS : number of instruction fetch misses
|
||||
+event:0x01 counters:0,1 um:zero minimum:500 name:CYCLES_IFU_MEM_STALL : cycles instruction fetch pipe is stalled
|
||||
+event:0x02 counters:0,1 um:zero minimum:500 name:CYCLES_DATA_STALL : cycles stall occurs for due to data dependency
|
||||
+event:0x03 counters:0,1 um:zero minimum:500 name:ITLB_MISS : number of Instruction MicroTLB misses
|
||||
+event:0x04 counters:0,1 um:zero minimum:500 name:DTLB_MISS : number of Data MicroTLB misses
|
||||
+event:0x05 counters:0,1 um:zero minimum:500 name:BR_INST_EXECUTED : branch instruction executed w/ or w/o program flow change
|
||||
+event:0x06 counters:0,1 um:zero minimum:500 name:BR_INST_MISS_PRED : branch mispredicted
|
||||
+event:0x07 counters:0,1 um:zero minimum:500 name:INSN_EXECUTED : instructions executed
|
||||
+event:0x09 counters:0,1 um:zero minimum:500 name:DCACHE_ACCESS : data cache access, cacheable locations
|
||||
+event:0x0a counters:0,1 um:zero minimum:500 name:DCACHE_ACCESS_ALL : data cache access, all locations
|
||||
+event:0x0b counters:0,1 um:zero minimum:500 name:DCACHE_MISS : data cache miss
|
||||
+event:0x0c counters:0,1 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline
|
||||
+event:0x0d counters:0,1 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch
|
||||
+event:0x0f counters:0,1 um:zero minimum:500 name:TLB_MISS : Main TLB miss
|
||||
+event:0x10 counters:0,1 um:zero minimum:500 name:EXP_EXTERNAL : Explict external data access
|
||||
+event:0x11 counters:0,1 um:zero minimum:500 name:LSU_STALL : cycles stalled because Load Store request queque is full
|
||||
+event:0x12 counters:0,1 um:zero minimum:500 name:WRITE_DRAIN : Times write buffer was drained
|
||||
+event:0x20 counters:0,1 um:zero minimum:500 name:ETMEXTOUT0 : nuber of cycles ETMEXTOUT[0] signal was asserted
|
||||
+event:0x21 counters:0,1 um:zero minimum:500 name:ETMEXTOUT1 : nuber of cycles ETMEXTOUT[1] signal was asserted
|
||||
+event:0x22 counters:0,1 um:zero minimum:500 name:ETMEXTOUT_BOTH : nuber of cycles both ETMEXTOUT [0] and [1] were asserted * 2
|
||||
+event:0xff counters:0,1,2 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
|
||||
149
meta/packages/oprofile/oprofile/opstart.patch
Normal file
149
meta/packages/oprofile/oprofile/opstart.patch
Normal file
@@ -0,0 +1,149 @@
|
||||
---
|
||||
configure.in | 1
|
||||
utils/Makefile.am | 11 +++++
|
||||
utils/opstart.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 116 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: oprofile-0.9.3/utils/Makefile.am
|
||||
===================================================================
|
||||
--- oprofile-0.9.3.orig/utils/Makefile.am 2007-09-05 12:55:48.000000000 +0100
|
||||
+++ oprofile-0.9.3/utils/Makefile.am 2007-09-05 15:20:34.000000000 +0100
|
||||
@@ -3,8 +3,15 @@ AM_CFLAGS = @OP_CFLAGS@
|
||||
|
||||
LIBS=@POPT_LIBS@ @LIBERTY_LIBS@
|
||||
|
||||
-bin_PROGRAMS = ophelp
|
||||
+bin_PROGRAMS = ophelp opstart
|
||||
dist_bin_SCRIPTS = opcontrol
|
||||
|
||||
ophelp_SOURCES = ophelp.c
|
||||
ophelp_LDADD = ../libop/libop.a ../libutil/libutil.a
|
||||
+
|
||||
+opstart_SOURCES = opstart.c
|
||||
+
|
||||
+install-exec-local:
|
||||
+ cd $(DESTDIR)/$(bindir) && \
|
||||
+ rm -f opstop && \
|
||||
+ $(LN_S) opstart opstop
|
||||
Index: oprofile-0.9.3/utils/opstart.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ oprofile-0.9.3/utils/opstart.c 2007-09-05 15:27:38.000000000 +0100
|
||||
@@ -0,0 +1,105 @@
|
||||
+/**
|
||||
+ * @file opstart.c
|
||||
+ * Start/Stop oprofile
|
||||
+ *
|
||||
+ * @remark Copyright 2007 Openedhand Ltd.
|
||||
+ * @remark Read the file COPYING
|
||||
+ *
|
||||
+ * @author Richard Purdie
|
||||
+ */
|
||||
+
|
||||
+#include <signal.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+
|
||||
+int main(const int argc, const char* argv[])
|
||||
+{
|
||||
+ const char *enable = "/dev/oprofile/enable";
|
||||
+ const char *lockfile;
|
||||
+ unsigned long dpid;
|
||||
+ struct stat sbuf;
|
||||
+ FILE *lfile, *efile;
|
||||
+ int sig, enb, err;
|
||||
+
|
||||
+ lockfile = getenv("LOCK_FILE");
|
||||
+ if (!lockfile)
|
||||
+ lockfile = "/var/lib/oprofile/lock";
|
||||
+
|
||||
+ /* Add SESSION_DIR support? */
|
||||
+
|
||||
+ if (geteuid()) {
|
||||
+ printf("Error: This program must be run as root.\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (stat(enable, &sbuf)) {
|
||||
+ printf("Error: Could not find /dev/oprofile/enable, the"
|
||||
+ " kernel module probably isn't loaded.\n");
|
||||
+ printf("This binary only works with 2.6 kernels and oprofile"
|
||||
+ " must have been initialised with 'opcontrol --start-daemon'.\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (stat(lockfile, &sbuf)) {
|
||||
+ printf("Error: Could not find lockfile %s.\n", lockfile);
|
||||
+ printf("The oprofile daemon must be running (oprofile must"
|
||||
+ " have been initialised with 'opcontrol --start-daemon').\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ lfile = fopen(lockfile, "r");
|
||||
+ if (!lfile) {
|
||||
+ printf("Error opening lockfile %s.\n", lockfile);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ err = fscanf(lfile, "%ud", &dpid);
|
||||
+ if (err != 1) {
|
||||
+ printf("Error reading pid from lockfile %s.\n", lockfile);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ fclose(lfile);
|
||||
+
|
||||
+ efile = fopen(enable, "r");
|
||||
+ if (!efile) {
|
||||
+ printf("Error opening %s.\n", enable);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ if (strstr(argv[0], "opstart")) {
|
||||
+ printf("Starting Profiler\n");
|
||||
+ sig = SIGUSR1;
|
||||
+ enb = 1;
|
||||
+ } else if (strstr(argv[0], "opstop")) {
|
||||
+ printf("Stopping Oprofile.\n");
|
||||
+ printf("You need to run 'opcontrol --dump' when the session"
|
||||
+ " is finished.\n");
|
||||
+ sig = SIGUSR2;
|
||||
+ enb = 0;
|
||||
+ } else {
|
||||
+ printf("Error: Please call as 'opstart' or 'opstop'\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ err = kill(dpid, 0);
|
||||
+ if (err) {
|
||||
+ printf("Error sending signal to oprofiled. Stale lockfile"
|
||||
+ " (%s) ?\n", lockfile);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ fprintf(efile, "%d\n", enb);
|
||||
+ err = kill(dpid, sig);
|
||||
+ if (err) {
|
||||
+ printf("Error sending signal to oprofiled. Stale lockfile"
|
||||
+ " (%s) ?\n", lockfile);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
Index: oprofile-0.9.3/configure.in
|
||||
===================================================================
|
||||
--- oprofile-0.9.3.orig/configure.in 2007-09-05 15:23:24.000000000 +0100
|
||||
+++ oprofile-0.9.3/configure.in 2007-09-05 15:23:36.000000000 +0100
|
||||
@@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE(oprofile, 0.9.3)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_PROG_RANLIB
|
||||
+AC_PROG_LN_S
|
||||
|
||||
dnl for the man page
|
||||
DATE="`date '+%a %d %B %Y'`"
|
||||
@@ -4,8 +4,11 @@ of profiling all running code at low overhead."
|
||||
LICENSE = "GPL"
|
||||
DEPENDS = "popt binutils"
|
||||
RDEPENDS = "binutils-symlinks"
|
||||
PR = "r2"
|
||||
|
||||
SRC_URI = "${SOURCEFORGE_MIRROR}/oprofile/oprofile-${PV}.tar.gz \
|
||||
file://opstart.patch;patch=1 \
|
||||
file://armv6_fix.patch;patch=1 \
|
||||
file://acinclude.m4"
|
||||
S = "${WORKDIR}/oprofile-${PV}"
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ DEPENDS = "popt binutils"
|
||||
RDEPENDS = "binutils-symlinks"
|
||||
|
||||
SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=oprofile \
|
||||
file://opstart.patch;patch=1 \
|
||||
file://armv6_fix.patch;patch=1 \
|
||||
file://acinclude.m4"
|
||||
S = "${WORKDIR}/oprofile"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user