summaryrefslogtreecommitdiffstats
path: root/meta/packages/oprofile/oprofile
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-10-01 09:21:56 +0000
committerRichard Purdie <richard@openedhand.com>2007-10-01 09:21:56 +0000
commit7aca4568945bd6df3838eb65e7a9f17eb2094683 (patch)
tree6d62c3a9a7c4836aa0545934775a7d0662d9736e /meta/packages/oprofile/oprofile
parent596b7b888dffe91768175c8298de7cfb5f1d8381 (diff)
downloadpoky-7aca4568945bd6df3838eb65e7a9f17eb2094683.tar.gz
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
Diffstat (limited to 'meta/packages/oprofile/oprofile')
-rw-r--r--meta/packages/oprofile/oprofile/armv6_fix.patch54
-rw-r--r--meta/packages/oprofile/oprofile/opstart.patch149
2 files changed, 203 insertions, 0 deletions
diff --git a/meta/packages/oprofile/oprofile/armv6_fix.patch b/meta/packages/oprofile/oprofile/armv6_fix.patch
new file mode 100644
index 0000000000..b981871e6e
--- /dev/null
+++ b/meta/packages/oprofile/oprofile/armv6_fix.patch
@@ -0,0 +1,54 @@
1---
2 events/arm/armv6/events | 43 +++++++++++++++++++++----------------------
3 1 file changed, 21 insertions(+), 22 deletions(-)
4
5Index: oprofile-0.9.3/events/arm/armv6/events
6===================================================================
7--- oprofile-0.9.3.orig/events/arm/armv6/events 2007-07-16 19:22:17.000000000 +0100
8+++ oprofile-0.9.3/events/arm/armv6/events 2007-09-28 11:13:32.000000000 +0100
9@@ -1,24 +1,23 @@
10 # ARM V6 events
11 #
12-event:0x00 counters:1,2 um:zero minimum:500 name:IFU_IFETCH_MISS : number of instruction fetch misses
13-event:0x01 counters:1,2 um:zero minimum:500 name:CYCLES_IFU_MEM_STALL : cycles instruction fetch pipe is stalled
14-event:0x02 counters:1,2 um:zero minimum:500 name:CYCLES_DATA_STALL : cycles stall occurs for due to data dependency
15-event:0x03 counters:1,2 um:zero minimum:500 name:ITLB_MISS : number of Instruction MicroTLB misses
16-event:0x04 counters:1,2 um:zero minimum:500 name:DTLB_MISS : number of Data MicroTLB misses
17-event:0x05 counters:1,2 um:zero minimum:500 name:BR_INST_EXECUTED : branch instruction executed w/ or w/o program flow change
18-event:0x06 counters:1,2 um:zero minimum:500 name:BR_INST_MISS_PRED : branch mispredicted
19-event:0x07 counters:1,2 um:zero minimum:500 name:INSN_EXECUTED : instructions executed
20-event:0x09 counters:1,2 um:zero minimum:500 name:DCACHE_ACCESS : data cache access, cacheable locations
21-event:0x0a counters:1,2 um:zero minimum:500 name:DCACHE_ACCESS_ALL : data cache access, all locations
22-event:0x0b counters:1,2 um:zero minimum:500 name:DCACHE_MISS : data cache miss
23-event:0x0c counters:1,2 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline
24-event:0x0d counters:1,2 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch
25-event:0x0f counters:1,2 um:zero minimum:500 name:TLB_MISS : Main TLB miss
26-event:0x10 counters:1,2 um:zero minimum:500 name:EXP_EXTERNAL : Explict external data access
27-event:0x11 counters:1,2 um:zero minimum:500 name:LSU_STALL : cycles stalled because Load Store request queque is full
28-event:0x12 counters:1,2 um:zero minimum:500 name:WRITE_DRAIN : Times write buffer was drained
29-event:0x20 counters:1,2 um:zero minimum:500 name:ETMEXTOUT0 : nuber of cycles ETMEXTOUT[0] signal was asserted
30-event:0x21 counters:1,2 um:zero minimum:500 name:ETMEXTOUT1 : nuber of cycles ETMEXTOUT[1] signal was asserted
31-event:0x22 counters:1,2 um:zero minimum:500 name:ETMEXTOUT_BOTH : nuber of cycles both ETMEXTOUT [0] and [1] were asserted * 2
32-event:0xff counters:1,2 um:zero minimum:500 name:CPU_CYCLES2 : clock cycles counter
33-event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
34+event:0x00 counters:0,1 um:zero minimum:500 name:IFU_IFETCH_MISS : number of instruction fetch misses
35+event:0x01 counters:0,1 um:zero minimum:500 name:CYCLES_IFU_MEM_STALL : cycles instruction fetch pipe is stalled
36+event:0x02 counters:0,1 um:zero minimum:500 name:CYCLES_DATA_STALL : cycles stall occurs for due to data dependency
37+event:0x03 counters:0,1 um:zero minimum:500 name:ITLB_MISS : number of Instruction MicroTLB misses
38+event:0x04 counters:0,1 um:zero minimum:500 name:DTLB_MISS : number of Data MicroTLB misses
39+event:0x05 counters:0,1 um:zero minimum:500 name:BR_INST_EXECUTED : branch instruction executed w/ or w/o program flow change
40+event:0x06 counters:0,1 um:zero minimum:500 name:BR_INST_MISS_PRED : branch mispredicted
41+event:0x07 counters:0,1 um:zero minimum:500 name:INSN_EXECUTED : instructions executed
42+event:0x09 counters:0,1 um:zero minimum:500 name:DCACHE_ACCESS : data cache access, cacheable locations
43+event:0x0a counters:0,1 um:zero minimum:500 name:DCACHE_ACCESS_ALL : data cache access, all locations
44+event:0x0b counters:0,1 um:zero minimum:500 name:DCACHE_MISS : data cache miss
45+event:0x0c counters:0,1 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline
46+event:0x0d counters:0,1 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch
47+event:0x0f counters:0,1 um:zero minimum:500 name:TLB_MISS : Main TLB miss
48+event:0x10 counters:0,1 um:zero minimum:500 name:EXP_EXTERNAL : Explict external data access
49+event:0x11 counters:0,1 um:zero minimum:500 name:LSU_STALL : cycles stalled because Load Store request queque is full
50+event:0x12 counters:0,1 um:zero minimum:500 name:WRITE_DRAIN : Times write buffer was drained
51+event:0x20 counters:0,1 um:zero minimum:500 name:ETMEXTOUT0 : nuber of cycles ETMEXTOUT[0] signal was asserted
52+event:0x21 counters:0,1 um:zero minimum:500 name:ETMEXTOUT1 : nuber of cycles ETMEXTOUT[1] signal was asserted
53+event:0x22 counters:0,1 um:zero minimum:500 name:ETMEXTOUT_BOTH : nuber of cycles both ETMEXTOUT [0] and [1] were asserted * 2
54+event:0xff counters:0,1,2 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
diff --git a/meta/packages/oprofile/oprofile/opstart.patch b/meta/packages/oprofile/oprofile/opstart.patch
new file mode 100644
index 0000000000..45109167a4
--- /dev/null
+++ b/meta/packages/oprofile/oprofile/opstart.patch
@@ -0,0 +1,149 @@
1---
2 configure.in | 1
3 utils/Makefile.am | 11 +++++
4 utils/opstart.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 3 files changed, 116 insertions(+), 1 deletion(-)
6
7Index: oprofile-0.9.3/utils/Makefile.am
8===================================================================
9--- oprofile-0.9.3.orig/utils/Makefile.am 2007-09-05 12:55:48.000000000 +0100
10+++ oprofile-0.9.3/utils/Makefile.am 2007-09-05 15:20:34.000000000 +0100
11@@ -3,8 +3,15 @@ AM_CFLAGS = @OP_CFLAGS@
12
13 LIBS=@POPT_LIBS@ @LIBERTY_LIBS@
14
15-bin_PROGRAMS = ophelp
16+bin_PROGRAMS = ophelp opstart
17 dist_bin_SCRIPTS = opcontrol
18
19 ophelp_SOURCES = ophelp.c
20 ophelp_LDADD = ../libop/libop.a ../libutil/libutil.a
21+
22+opstart_SOURCES = opstart.c
23+
24+install-exec-local:
25+ cd $(DESTDIR)/$(bindir) && \
26+ rm -f opstop && \
27+ $(LN_S) opstart opstop
28Index: oprofile-0.9.3/utils/opstart.c
29===================================================================
30--- /dev/null 1970-01-01 00:00:00.000000000 +0000
31+++ oprofile-0.9.3/utils/opstart.c 2007-09-05 15:27:38.000000000 +0100
32@@ -0,0 +1,105 @@
33+/**
34+ * @file opstart.c
35+ * Start/Stop oprofile
36+ *
37+ * @remark Copyright 2007 Openedhand Ltd.
38+ * @remark Read the file COPYING
39+ *
40+ * @author Richard Purdie
41+ */
42+
43+#include <signal.h>
44+#include <stdio.h>
45+#include <stdlib.h>
46+#include <string.h>
47+#include <unistd.h>
48+#include <sys/types.h>
49+#include <sys/stat.h>
50+
51+int main(const int argc, const char* argv[])
52+{
53+ const char *enable = "/dev/oprofile/enable";
54+ const char *lockfile;
55+ unsigned long dpid;
56+ struct stat sbuf;
57+ FILE *lfile, *efile;
58+ int sig, enb, err;
59+
60+ lockfile = getenv("LOCK_FILE");
61+ if (!lockfile)
62+ lockfile = "/var/lib/oprofile/lock";
63+
64+ /* Add SESSION_DIR support? */
65+
66+ if (geteuid()) {
67+ printf("Error: This program must be run as root.\n");
68+ return 1;
69+ }
70+
71+ if (stat(enable, &sbuf)) {
72+ printf("Error: Could not find /dev/oprofile/enable, the"
73+ " kernel module probably isn't loaded.\n");
74+ printf("This binary only works with 2.6 kernels and oprofile"
75+ " must have been initialised with 'opcontrol --start-daemon'.\n");
76+ return 1;
77+ }
78+
79+ if (stat(lockfile, &sbuf)) {
80+ printf("Error: Could not find lockfile %s.\n", lockfile);
81+ printf("The oprofile daemon must be running (oprofile must"
82+ " have been initialised with 'opcontrol --start-daemon').\n");
83+ return 1;
84+ }
85+
86+ lfile = fopen(lockfile, "r");
87+ if (!lfile) {
88+ printf("Error opening lockfile %s.\n", lockfile);
89+ return 1;
90+ }
91+
92+ err = fscanf(lfile, "%ud", &dpid);
93+ if (err != 1) {
94+ printf("Error reading pid from lockfile %s.\n", lockfile);
95+ return 1;
96+ }
97+ fclose(lfile);
98+
99+ efile = fopen(enable, "r");
100+ if (!efile) {
101+ printf("Error opening %s.\n", enable);
102+ return 1;
103+ }
104+
105+ if (strstr(argv[0], "opstart")) {
106+ printf("Starting Profiler\n");
107+ sig = SIGUSR1;
108+ enb = 1;
109+ } else if (strstr(argv[0], "opstop")) {
110+ printf("Stopping Oprofile.\n");
111+ printf("You need to run 'opcontrol --dump' when the session"
112+ " is finished.\n");
113+ sig = SIGUSR2;
114+ enb = 0;
115+ } else {
116+ printf("Error: Please call as 'opstart' or 'opstop'\n");
117+ return 1;
118+ }
119+
120+ err = kill(dpid, 0);
121+ if (err) {
122+ printf("Error sending signal to oprofiled. Stale lockfile"
123+ " (%s) ?\n", lockfile);
124+ return 1;
125+ }
126+
127+ fprintf(efile, "%d\n", enb);
128+ err = kill(dpid, sig);
129+ if (err) {
130+ printf("Error sending signal to oprofiled. Stale lockfile"
131+ " (%s) ?\n", lockfile);
132+ return 1;
133+ }
134+
135+ return 0;
136+}
137+
138Index: oprofile-0.9.3/configure.in
139===================================================================
140--- oprofile-0.9.3.orig/configure.in 2007-09-05 15:23:24.000000000 +0100
141+++ oprofile-0.9.3/configure.in 2007-09-05 15:23:36.000000000 +0100
142@@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE(oprofile, 0.9.3)
143 AM_CONFIG_HEADER(config.h)
144
145 AC_PROG_RANLIB
146+AC_PROG_LN_S
147
148 dnl for the man page
149 DATE="`date '+%a %d %B %Y'`"