summaryrefslogtreecommitdiffstats
path: root/meta/packages
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-05-23 13:33:49 +0000
committerRichard Purdie <richard@openedhand.com>2007-05-23 13:33:49 +0000
commit8e2698e0cb99f34abcc3def5c5479da29aacd89b (patch)
treec4408cd6a92ac15d54d02c5d7b6a6b67fcee5537 /meta/packages
parent6c3d3eff91f011675be178c3b8d45cfa21f8a504 (diff)
downloadpoky-8e2698e0cb99f34abcc3def5c5479da29aacd89b.tar.gz
oprofile: Add armv6 patch, drop merged patches, fix xscale events
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1767 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages')
-rw-r--r--meta/packages/oprofile/oprofile/armv6_events.patch118
-rw-r--r--meta/packages/oprofile/oprofile/cg_collection.patch289
-rw-r--r--meta/packages/oprofile/oprofile/oprofile_eabi.patch30
-rw-r--r--meta/packages/oprofile/oprofile/xml_callgraph.patch542
-rw-r--r--meta/packages/oprofile/oprofile/xscale_events.patch39
-rw-r--r--meta/packages/oprofile/oprofile_cvs.bb8
6 files changed, 160 insertions, 866 deletions
diff --git a/meta/packages/oprofile/oprofile/armv6_events.patch b/meta/packages/oprofile/oprofile/armv6_events.patch
new file mode 100644
index 0000000000..fc9a56b8ae
--- /dev/null
+++ b/meta/packages/oprofile/oprofile/armv6_events.patch
@@ -0,0 +1,118 @@
1---
2 events/Makefile.am | 1 +
3 events/arm/armv6/events | 25 +++++++++++++++++++++++++
4 events/arm/armv6/unit_masks | 4 ++++
5 libop/op_cpu_type.c | 1 +
6 libop/op_cpu_type.h | 1 +
7 libop/op_events.c | 1 +
8 utils/ophelp.c | 5 ++++-
9 7 files changed, 37 insertions(+), 1 deletion(-)
10
11Index: oprofile/events/Makefile.am
12===================================================================
13--- oprofile.orig/events/Makefile.am 2007-05-23 11:32:24.000000000 +0100
14+++ oprofile/events/Makefile.am 2007-05-23 14:13:12.000000000 +0100
15@@ -29,6 +29,7 @@ event_files = \
16 x86-64/family10/events x86-64/family10/unit_masks \
17 arm/xscale1/events arm/xscale1/unit_masks \
18 arm/xscale2/events arm/xscale2/unit_masks \
19+ arm/armv6/events arm/armv6/unit_masks \
20 mips/20K/events mips/20K/unit_masks \
21 mips/24K/events mips/24K/unit_masks \
22 mips/25K/events mips/25K/unit_masks \
23Index: oprofile/events/arm/armv6/events
24===================================================================
25--- /dev/null 1970-01-01 00:00:00.000000000 +0000
26+++ oprofile/events/arm/armv6/events 2007-05-23 14:13:12.000000000 +0100
27@@ -0,0 +1,25 @@
28+# ARM V6 events
29+#
30+event:0x00 counters:1,2 um:zero minimum:500 name:IFU_IFETCH_MISS : number of instruction fetch misses
31+event:0x01 counters:1,2 um:zero minimum:500 name:CYCLES_IFU_MEM_STALL : cycles instruction fetch pipe is stalled
32+event:0x02 counters:1,2 um:zero minimum:500 name:CYCLES_DATA_STALL : cycles stall occurs for due to data dependency
33+event:0x03 counters:1,2 um:zero minimum:500 name:ITLB_MISS : number of ITLB misses
34+event:0x04 counters:1,2 um:zero minimum:500 name:DTLB_MISS : number of DTLB misses
35+event:0x05 counters:1,2 um:zero minimum:500 name:BR_INST_EXECUTED : branch instruction executed w/ or w/o program flow change
36+event:0x06 counters:1,2 um:zero minimum:500 name:BR_INST_MISS_PRED : branch mispredicted
37+event:0x07 counters:1,2 um:zero minimum:500 name:INSN_EXECUTED : instruction executed
38+event:0x08 counters:1,2 um:zero minimum:500 name:CYCLES_DCACHE_FULL_STALL : cycles in stall due to full dcache
39+event:0x09 counters:1,1 um:zero minimum:500 name:DCACHE_FULL_STALL_CNT : number of stalls due to dcache full condition
40+event:0x0a counters:1,2 um:zero minimum:500 name:DCACHE_ACCESS : data cache access
41+event:0x0b counters:1,2 um:zero minimum:500 name:DCACHE_MISS : data cache miss
42+event:0x0c counters:1,2 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline
43+event:0x0d counters:1,2 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch
44+event:0x0f counters:1,2 um:zero minimum:500 name:TLB_MISS : Main TLB miss
45+event:0x10 counters:1,2 um:zero minimum:500 name:EXP_EXTERNAL : Explict external data access
46+event:0x11 counters:1,2 um:zero minimum:500 name:LSU_STALL : cycles stalled because Load Store request queque is full
47+event:0x12 counters:1,2 um:zero minimum:500 name:WRITE_DRAIN : Time swrite buffer was drained
48+event:0x20 counters:1,2 um:zero minimum:500 name:ETMEXTOUT0 : nuber of cycles ETMEXTOUT[0] signal was asserted
49+event:0x21 counters:1,2 um:zero minimum:500 name:ETMEXTOUT1 : nuber of cycles ETMEXTOUT[1] signal was asserted
50+event:0x22 counters:1,2 um:zero minimum:500 name:ETMEXTOUT_BOTH : nuber of cycles both ETMEXTOUT [0] and [1] were asserted * 2
51+event:0xff counters:1,2 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
52+event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
53Index: oprofile/events/arm/armv6/unit_masks
54===================================================================
55--- /dev/null 1970-01-01 00:00:00.000000000 +0000
56+++ oprofile/events/arm/armv6/unit_masks 2007-05-23 14:13:12.000000000 +0100
57@@ -0,0 +1,4 @@
58+# ARM V6 PMU possible unit masks
59+#
60+name:zero type:mandatory default:0x00
61+ 0x00 No unit mask
62Index: oprofile/libop/op_cpu_type.c
63===================================================================
64--- oprofile.orig/libop/op_cpu_type.c 2007-05-23 11:32:35.000000000 +0100
65+++ oprofile/libop/op_cpu_type.c 2007-05-23 14:13:12.000000000 +0100
66@@ -69,6 +69,7 @@ static struct cpu_descr const cpu_descrs
67 { "ppc64 Cell Broadband Engine", "ppc64/cell-be", CPU_PPC64_CELL, 8 },
68 { "AMD64 family10", "x86-64/family10", CPU_FAMILY10, 4 },
69 { "ppc64 PA6T", "ppc64/pa6t", CPU_PPC64_PA6T, 6 },
70+ { "ARM/V6 PMU", "arm/armv6", CPU_ARM_V6, 3 },
71 };
72
73 static size_t const nr_cpu_descrs = sizeof(cpu_descrs) / sizeof(struct cpu_descr);
74Index: oprofile/libop/op_cpu_type.h
75===================================================================
76--- oprofile.orig/libop/op_cpu_type.h 2007-05-23 11:32:35.000000000 +0100
77+++ oprofile/libop/op_cpu_type.h 2007-05-23 14:13:12.000000000 +0100
78@@ -67,6 +67,7 @@ typedef enum {
79 CPU_PPC64_CELL, /**< ppc64 Cell Broadband Engine*/
80 CPU_FAMILY10, /**< AMD family 10 */
81 CPU_PPC64_PA6T, /**< ppc64 PA6T */
82+ CPU_ARM_V6, /**< ARM V6 PMU */
83 MAX_CPU_TYPE
84 } op_cpu;
85
86Index: oprofile/libop/op_events.c
87===================================================================
88--- oprofile.orig/libop/op_events.c 2007-05-23 11:32:35.000000000 +0100
89+++ oprofile/libop/op_events.c 2007-05-23 14:13:12.000000000 +0100
90@@ -785,6 +785,7 @@ void op_default_event(op_cpu cpu_type, s
91 // we could possibly use the CCNT
92 case CPU_ARM_XSCALE1:
93 case CPU_ARM_XSCALE2:
94+ case CPU_ARM_V6:
95 descr->name = "CPU_CYCLES";
96 break;
97
98Index: oprofile/utils/ophelp.c
99===================================================================
100--- oprofile.orig/utils/ophelp.c 2007-05-23 11:32:45.000000000 +0100
101+++ oprofile/utils/ophelp.c 2007-05-23 14:16:33.000000000 +0100
102@@ -424,12 +424,15 @@ int main(int argc, char const * argv[])
103 printf("See Intel XScale Core Developer's Manual\n"
104 "Chapter 8 Performance Monitoring\n");
105 break;
106+
107+ case CPU_ARM_V6:
108+ printf("See ARM11 Technical Reference Manual\n");
109 break;
110
111 case CPU_PPC64_PA6T:
112 printf("See PA6T Power Implementation Features Book IV\n"
113 "Chapter 7 Performance Counters\n");
114- break;
115+ break;
116
117 case CPU_PPC64_POWER4:
118 case CPU_PPC64_POWER5:
diff --git a/meta/packages/oprofile/oprofile/cg_collection.patch b/meta/packages/oprofile/oprofile/cg_collection.patch
deleted file mode 100644
index a87ec72477..0000000000
--- a/meta/packages/oprofile/oprofile/cg_collection.patch
+++ /dev/null
@@ -1,289 +0,0 @@
1 ChangeLog | 12 ++++++++++++
2 libpp/callgraph_container.cpp | 21 +++++++++++++--------
3 libpp/callgraph_container.h | 7 ++++---
4 libpp/format_output.cpp | 22 +++++++++++-----------
5 libpp/format_output.h | 2 +-
6 libpp/symbol.h | 14 ++++++++------
7 libpp/symbol_sort.cpp | 17 -----------------
8 libpp/symbol_sort.h | 6 ------
9 pp/opreport.cpp | 3 ++-
10 9 files changed, 51 insertions(+), 53 deletions(-)
11
12Index: oprofile/libpp/callgraph_container.cpp
13===================================================================
14--- oprofile.orig/libpp/callgraph_container.cpp
15+++ oprofile/libpp/callgraph_container.cpp
16@@ -379,12 +379,15 @@ process(count_array_t total, double thre
17
18 process_children(sym, threshold);
19
20- cg_syms.push_back(sym);
21+ cg_syms_objs.push_back(sym);
22 }
23+
24+ for (unsigned int i = 0; i < cg_syms_objs.size(); i++)
25+ cg_syms.push_back(&cg_syms_objs[i]);
26 }
27
28
29-cg_collection arc_recorder::get_symbols() const
30+symbol_collection arc_recorder::get_symbols() const
31 {
32 return cg_syms;
33 }
34@@ -580,12 +583,14 @@ column_flags callgraph_container::output
35 column_flags output_hints = cf_none;
36
37 // FIXME: costly: must we access directly recorder map ?
38- cg_collection syms = recorder.get_symbols();
39+ symbol_collection syms = recorder.get_symbols();
40
41- cg_collection::const_iterator it;
42- cg_collection::const_iterator const end = syms.end();
43- for (it = syms.begin(); it != end; ++it)
44- output_hints = it->output_hint(output_hints);
45+ symbol_collection::iterator it;
46+ symbol_collection::iterator const end = syms.end();
47+ for (it = syms.begin(); it != end; ++it) {
48+ cg_symbol const *cg_symb = dynamic_cast<const cg_symbol *>(*it);
49+ output_hints = cg_symb->output_hint(output_hints);
50+ }
51
52 return output_hints;
53 }
54@@ -597,7 +602,7 @@ count_array_t callgraph_container::sampl
55 }
56
57
58-cg_collection callgraph_container::get_symbols() const
59+symbol_collection callgraph_container::get_symbols() const
60 {
61 return recorder.get_symbols();
62 }
63Index: oprofile/libpp/callgraph_container.h
64===================================================================
65--- oprofile.orig/libpp/callgraph_container.h
66+++ oprofile/libpp/callgraph_container.h
67@@ -53,7 +53,7 @@ public:
68 count_array_t const & arc_count);
69
70 /// return all the cg symbols
71- cg_collection get_symbols() const;
72+ symbol_collection get_symbols() const;
73
74 /**
75 * After population, build the final output, and do
76@@ -91,7 +91,8 @@ private:
77 map_t sym_map;
78
79 /// final output data
80- cg_collection cg_syms;
81+ symbol_collection cg_syms;
82+ cg_collection_objs cg_syms_objs;
83 };
84
85
86@@ -126,7 +127,7 @@ public:
87 count_array_t samples_count() const;
88
89 // return all the cg symbols
90- cg_collection get_symbols() const;
91+ symbol_collection get_symbols() const;
92
93 private:
94 /**
95Index: oprofile/libpp/format_output.cpp
96===================================================================
97--- oprofile.orig/libpp/format_output.cpp
98+++ oprofile/libpp/format_output.cpp
99@@ -489,7 +489,7 @@ cg_formatter::cg_formatter(callgraph_con
100 }
101
102
103-void cg_formatter::output(ostream & out, cg_collection const & syms)
104+void cg_formatter::output(ostream & out, symbol_collection const & syms)
105 {
106 // amount of spacing prefixing child and parent lines
107 string const child_parent_prefix(" ");
108@@ -498,37 +498,37 @@ void cg_formatter::output(ostream & out,
109
110 out << string(79, '-') << endl;
111
112- cg_collection::const_iterator it;
113- cg_collection::const_iterator end = syms.end();
114+ symbol_collection::const_iterator it;
115+ symbol_collection::const_iterator end = syms.end();
116
117 for (it = syms.begin(); it < end; ++it) {
118- cg_symbol const & sym = *it;
119+ cg_symbol const *sym = dynamic_cast<const cg_symbol *>(*it);
120
121 cg_symbol::children::const_iterator cit;
122- cg_symbol::children::const_iterator cend = sym.callers.end();
123+ cg_symbol::children::const_iterator cend = sym->callers.end();
124
125 counts_t c;
126 if (global_percent)
127 c.total = counts.total;
128 else
129- c.total = sym.total_caller_count;
130+ c.total = sym->total_caller_count;
131
132- for (cit = sym.callers.begin(); cit != cend; ++cit) {
133+ for (cit = sym->callers.begin(); cit != cend; ++cit) {
134 out << child_parent_prefix;
135 do_output(out, *cit, cit->sample, c);
136 }
137
138- do_output(out, sym, sym.sample, counts);
139+ do_output(out, *sym, sym->sample, counts);
140
141 c = counts_t();
142 if (global_percent)
143 c.total = counts.total;
144 else
145- c.total = sym.total_callee_count;
146+ c.total = sym->total_callee_count;
147
148- cend = sym.callees.end();
149+ cend = sym->callees.end();
150
151- for (cit = sym.callees.begin(); cit != cend; ++cit) {
152+ for (cit = sym->callees.begin(); cit != cend; ++cit) {
153 out << child_parent_prefix;
154 do_output(out, *cit, cit->sample, c);
155 }
156Index: oprofile/libpp/symbol.h
157===================================================================
158--- oprofile.orig/libpp/symbol.h
159+++ oprofile/libpp/symbol.h
160@@ -56,8 +56,11 @@ struct sample_entry {
161
162
163 /// associate a symbol with a file location, samples count and vma address
164-struct symbol_entry {
165+class symbol_entry {
166+public:
167 symbol_entry() : size(0) {}
168+ virtual ~symbol_entry() {}
169+
170 /// which image this symbol belongs to
171 image_name_id image_name;
172 /// owning application name: identical to image name if profiling
173@@ -93,7 +96,8 @@ typedef std::vector<symbol_entry const *
174 * the sample counts replaced with the relevant arc counts, whilst
175 * the cg_symbol retains its self count.
176 */
177-struct cg_symbol : public symbol_entry {
178+class cg_symbol : public symbol_entry {
179+public:
180 cg_symbol(symbol_entry const & sym) : symbol_entry(sym) {}
181
182 typedef std::vector<symbol_entry> children;
183@@ -109,10 +113,8 @@ struct cg_symbol : public symbol_entry {
184 count_array_t total_callee_count;
185 };
186
187-
188-/// a collection of sorted callgraph symbols
189-typedef std::vector<cg_symbol> cg_collection;
190-
191+/// a collection of sorted callgraph symbol objects
192+typedef std::vector<cg_symbol> cg_collection_objs;
193
194 /// for storing diff %ages
195 typedef growable_vector<double> diff_array_t;
196Index: oprofile/libpp/symbol_sort.cpp
197===================================================================
198--- oprofile.orig/libpp/symbol_sort.cpp
199+++ oprofile/libpp/symbol_sort.cpp
200@@ -146,23 +146,6 @@ sort(symbol_collection & syms, bool reve
201
202
203 void sort_options::
204-sort(cg_collection & syms, bool reverse_sort, bool lf) const
205-{
206- long_filenames = lf;
207-
208- vector<sort_order> sort_option(options);
209- for (sort_order cur = first; cur != last; cur = sort_order(cur + 1)) {
210- if (find(sort_option.begin(), sort_option.end(), cur) ==
211- sort_option.end())
212- sort_option.push_back(cur);
213- }
214-
215- stable_sort(syms.begin(), syms.end(),
216- symbol_compare(sort_option, reverse_sort));
217-}
218-
219-
220-void sort_options::
221 sort(diff_collection & syms, bool reverse_sort, bool lf) const
222 {
223 long_filenames = lf;
224Index: oprofile/libpp/symbol_sort.h
225===================================================================
226--- oprofile.orig/libpp/symbol_sort.h
227+++ oprofile/libpp/symbol_sort.h
228@@ -44,12 +44,6 @@ struct sort_options {
229 /**
230 * Sort the given container by the given criteria.
231 */
232- void sort(cg_collection & syms, bool reverse_sort,
233- bool long_filenames) const;
234-
235- /**
236- * Sort the given container by the given criteria.
237- */
238 void sort(diff_collection & syms, bool reverse_sort,
239 bool long_filenames) const;
240
241Index: oprofile/pp/opreport.cpp
242===================================================================
243--- oprofile.orig/pp/opreport.cpp
244+++ oprofile/pp/opreport.cpp
245@@ -445,7 +445,8 @@ void output_cg_symbols(callgraph_contain
246 {
247 column_flags output_hints = cg.output_hint();
248
249- cg_collection symbols = cg.get_symbols();
250+ symbol_collection symbols = cg.get_symbols();
251+
252 options::sort_by.sort(symbols, options::reverse_sort,
253 options::long_filenames);
254
255Index: oprofile/ChangeLog
256===================================================================
257--- oprofile.orig/ChangeLog
258+++ oprofile/ChangeLog
259@@ -1,5 +1,17 @@
260 2007-05-09 Richard Purdie <rpurdie@openedhand.com>
261
262+ * libpp/callgraph_container.cpp:
263+ * libpp/callgraph_container.h:
264+ * libpp/format_output.cpp:
265+ * libpp/format_output.h:
266+ * libpp/symbol.h:
267+ * libpp/symbol_sort.cpp:
268+ * libpp/symbol_sort.h:
269+ * pp/opreport.cpp: Convert cg_collection to symbol_collection and use
270+ dynamic casting allowing more code reuse for callgraphs
271+
272+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
273+
274 * oparchive.cpp:
275 * oparchive_options.cpp:
276 * oparchive_options.h: Add --list-files option to list all files that
277Index: oprofile/libpp/format_output.h
278===================================================================
279--- oprofile.orig/libpp/format_output.h
280+++ oprofile/libpp/format_output.h
281@@ -201,7 +201,7 @@ public:
282
283 /** output callgraph information according to the previously format
284 * specifier set by call(s) to add_format() */
285- void output(std::ostream & out, cg_collection const & syms);
286+ void output(std::ostream & out, symbol_collection const & syms);
287 };
288
289 /// class to output a columned format symbols plus diff values
diff --git a/meta/packages/oprofile/oprofile/oprofile_eabi.patch b/meta/packages/oprofile/oprofile/oprofile_eabi.patch
deleted file mode 100644
index 2ae269f867..0000000000
--- a/meta/packages/oprofile/oprofile/oprofile_eabi.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1---
2 daemon/opd_cookie.c | 3 ++-
3 1 file changed, 2 insertions(+), 1 deletion(-)
4
5Index: oprofile/daemon/opd_cookie.c
6===================================================================
7--- oprofile.orig/daemon/opd_cookie.c
8+++ oprofile/daemon/opd_cookie.c
9@@ -68,7 +68,8 @@ static inline int lookup_dcookie(cookie_
10 return syscall(__NR_lookup_dcookie, (unsigned long)(cookie >> 32),
11 (unsigned long)(cookie & 0xffffffff), buf, size);
12 }
13-#elif (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)) /*_MIPSEL */
14+#elif (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)) \
15+ || (defined(__arm__) && defined(__ARM_EABI__))
16 static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
17 {
18 return syscall(__NR_lookup_dcookie,
19Index: oprofile/ChangeLog
20===================================================================
21--- oprofile.orig/ChangeLog
22+++ oprofile/ChangeLog
23@@ -1,3 +1,7 @@
24+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
25+
26+ * oprofile/daemon/opd_cookie.c: Fix syscall for ARM EABI
27+
28 2007-04-25 Manoj Ekbote <manoj.ekbote@broadcom.com>
29
30 * events/mips/sb1/events: fix SB1 events
diff --git a/meta/packages/oprofile/oprofile/xml_callgraph.patch b/meta/packages/oprofile/oprofile/xml_callgraph.patch
deleted file mode 100644
index f089e7dc4a..0000000000
--- a/meta/packages/oprofile/oprofile/xml_callgraph.patch
+++ /dev/null
@@ -1,542 +0,0 @@
1 ChangeLog | 10 ++
2 libpp/format_output.cpp | 178 +++++++++++++++++++++++++++++++++++++++++------
3 libpp/format_output.h | 40 ++++++++--
4 libpp/xml_utils.cpp | 17 +---
5 libutil++/xml_output.cpp | 3
6 libutil++/xml_output.h | 3
7 pp/opreport.cpp | 37 +++++++--
8 pp/opreport_options.cpp | 5 -
9 8 files changed, 238 insertions(+), 55 deletions(-)
10
11
12Index: oprofile/libpp/format_output.cpp
13===================================================================
14--- oprofile.orig/libpp/format_output.cpp
15+++ oprofile/libpp/format_output.cpp
16@@ -562,6 +562,20 @@ ostringstream bytes_out;
17 map<string, size_t> symbol_data_table;
18 size_t symbol_data_index = 0;
19
20+/* Return any existing index or add to the table */
21+size_t xml_get_symbol_index(string const name)
22+{
23+ size_t index = symbol_data_index;
24+ map<string, size_t>::iterator it = symbol_data_table.find(name);
25+
26+ if (it == symbol_data_table.end()) {
27+ symbol_data_table[name] = symbol_data_index++;
28+ return index;
29+ }
30+
31+ return it->second;
32+}
33+
34
35 class symbol_details_t {
36 public:
37@@ -577,14 +591,15 @@ symbol_details_array_t symbol_details;
38 size_t detail_table_index = 0;
39
40 xml_formatter::
41-xml_formatter(profile_container const & p,
42+xml_formatter(profile_container const *p,
43 symbol_collection & s)
44 :
45 profile(p),
46 symbols(s),
47 need_details(false)
48 {
49- counts.total = profile.samples_count();
50+ if (profile)
51+ counts.total = profile->samples_count();
52 }
53
54
55@@ -640,12 +655,11 @@ void xml_formatter::output_symbol_data(o
56 string const image = get_image_name(symb->image_name, true);
57 string const qname = image + ":" + name;
58 map<string, size_t>::iterator sd_it = symbol_data_table.find(qname);
59- size_t si = xml_support->get_symbol_index(it);
60
61- if (sd_it->second == si) {
62+ if (sd_it != symbol_data_table.end()) {
63 // first time we've seen this symbol
64 out << open_element(SYMBOL_DATA, true);
65- out << init_attr(TABLE_ID, si);
66+ out << init_attr(TABLE_ID, sd_it->second);
67
68 field_datum datum(*symb, symb->sample, 0, counts);
69
70@@ -660,9 +674,12 @@ void xml_formatter::output_symbol_data(o
71 output_attribute(out, datum, ff_vma, STARTING_ADDR);
72
73 if (need_details)
74- xml_support->output_symbol_bytes(bytes_out, symb, si);
75+ xml_support->output_symbol_bytes(bytes_out, symb, sd_it->second);
76 }
77 out << close_element();
78+
79+ // seen so remove (otherwise get several "no symbols")
80+ symbol_data_table.erase(qname);
81 }
82 }
83 out << close_element(SYMBOL_TABLE);
84@@ -675,8 +692,8 @@ output_symbol_details(symbol_entry const
85 if (!has_sample_counts(symb->sample.counts, lo, hi))
86 return "";
87
88- sample_container::samples_iterator it = profile.begin(symb);
89- sample_container::samples_iterator end = profile.end(symb);
90+ sample_container::samples_iterator it = profile->begin(symb);
91+ sample_container::samples_iterator end = profile->end(symb);
92
93 ostringstream str;
94 for (; it != end; ++it) {
95@@ -725,10 +742,11 @@ output_symbol_details(symbol_entry const
96
97 void xml_formatter::
98 output_symbol(ostream & out,
99- symbol_collection::const_iterator const it, size_t lo, size_t hi)
100+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module)
101 {
102- symbol_entry const * symb = *it;
103 ostringstream str;
104+ // pointless reference to is_module, remove insane compiler warning
105+ size_t indx = is_module ? 0 : 1;
106
107 // output symbol's summary data for each profile class
108 bool got_samples = false;
109@@ -752,27 +770,21 @@ output_symbol(ostream & out,
110
111 string const image = get_image_name(symb->image_name, true);
112 string const qname = image + ":" + name;
113- map<string, size_t>::iterator sd_it = symbol_data_table.find(qname);
114- size_t si = xml_support->get_symbol_index(it);
115
116- // if this is the first time we've seen this symbol, save it's index
117- if (sd_it == symbol_data_table.end())
118- symbol_data_table[qname] = si;
119- else
120- si = sd_it->second;
121+ indx = xml_get_symbol_index(qname);
122
123- out << init_attr(ID_REF, si);
124+ out << init_attr(ID_REF, indx);
125
126 if (need_details) {
127 ostringstream details;
128- symbol_details_t & sd = symbol_details[si];
129+ symbol_details_t & sd = symbol_details[indx];
130 size_t const detail_lo = sd.index;
131
132 string detail_str = output_symbol_details(symb, sd.index, lo, hi);
133
134 if (detail_str.size() > 0) {
135 if (sd.id < 0)
136- sd.id = si;
137+ sd.id = indx;
138 details << detail_str;
139 }
140
141@@ -828,5 +840,131 @@ output_attribute(ostream & out, field_da
142 }
143 }
144
145+xml_cg_formatter::
146+xml_cg_formatter(callgraph_container const * cg, symbol_collection & s)
147+ :
148+ xml_formatter(NULL, s),
149+ callgraph(cg)
150+{
151+ counts.total = callgraph->samples_count();
152+}
153+
154+void xml_cg_formatter::output(ostream & out)
155+{
156+ xml_support->build_subclasses(out);
157+
158+ xml_support->output_program_structure(out);
159+ output_symbol_data(out);
160+
161+ out << close_element(PROFILE);
162+}
163+
164+void xml_cg_formatter::
165+output_symbol_core(ostream & out, cg_symbol::children const cg_symb,
166+ string const selfname, string const qname,
167+ size_t lo, size_t hi, bool is_module, tag_t tag)
168+{
169+
170+ cg_symbol::children::const_iterator cit;
171+ cg_symbol::children::const_iterator cend = cg_symb.end();
172+
173+ for (cit = cg_symb.begin(); cit != cend; ++cit) {
174+ string binary = get_image_name((cit)->app_name, true);
175+ string module = get_image_name((cit)->image_name, true);
176+ bool got_samples = false, self = false;
177+ ostringstream str;
178+ size_t indx;
179+
180+ for (size_t p = lo; p <= hi; ++p)
181+ got_samples |= xml_support->output_summary_data(str, cit->sample.counts, p);
182+
183+ if (!got_samples)
184+ continue;
185+
186+ cverb << vxml << " <!-- symbol_ref=" << symbol_names.name(cit->name) << " -->" << endl;
187+
188+ if (is_module) {
189+ out << open_element(MODULE, true);
190+ out << init_attr(NAME, module) << close_element(NONE, true);
191+ }
192+
193+ out << open_element(SYMBOL, true);
194+
195+ string const symname = symbol_names.name(cit->name);
196+ assert(symname.size() > 0);
197+
198+ string const symqname = module + ":" + symname;
199+
200+ // Find any self references and handle
201+ if ((symname == selfname) && (tag == CALLEES)) {
202+ self = true;
203+ indx = xml_get_symbol_index(qname);
204+ } else
205+ indx = xml_get_symbol_index(symqname);
206+
207+ out << init_attr(ID_REF, indx);
208+
209+ if (self)
210+ out << init_attr(SELFREF, "true");
211+
212+ out << close_element(NONE, true);
213+ out << str.str();
214+ out << close_element(SYMBOL);
215+
216+ if (is_module)
217+ out << close_element(MODULE);
218+ }
219+}
220+
221+
222+void xml_cg_formatter::
223+output_symbol(ostream & out,
224+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module)
225+{
226+ cg_symbol const * cg_symb = dynamic_cast<const cg_symbol *>(symb);
227+ ostringstream str;
228+
229+ // output symbol's summary data for each profile class
230+ bool got_samples = false;
231+
232+ for (size_t p = lo; p <= hi; ++p) {
233+ got_samples |= xml_support->output_summary_data(str,
234+ symb->sample.counts, p);
235+ }
236+
237+ if (!got_samples)
238+ return;
239+
240+ cverb << vxml << " <!-- symbol_ref=" << symbol_names.name(symb->name) << " -->" << endl;
241+
242+ out << open_element(SYMBOL, true);
243+
244+ string const name = symbol_names.name(symb->name);
245+ assert(name.size() > 0);
246+
247+ string const image = get_image_name(symb->image_name, true);
248+ string const qname = image + ":" + name;
249+
250+ string const selfname = symbol_names.demangle(symb->name) + " [self]";
251+
252+ out << init_attr(ID_REF, xml_get_symbol_index(qname));
253+
254+ out << close_element(NONE, true);
255+
256+ out << open_element(CALLERS);
257+ if (cg_symb)
258+ output_symbol_core(out, cg_symb->callers, selfname, qname, lo, hi, is_module, CALLERS);
259+ out << close_element(CALLERS);
260+
261+ out << open_element(CALLEES);
262+ if (cg_symb)
263+ output_symbol_core(out, cg_symb->callees, selfname, qname, lo, hi, is_module, CALLEES);
264+
265+ out << close_element(CALLEES);
266+
267+ // output summary
268+ out << str.str();
269+ out << close_element(SYMBOL);
270+}
271
272 } // namespace format_output
273Index: oprofile/libpp/format_output.h
274===================================================================
275--- oprofile.orig/libpp/format_output.h
276+++ oprofile/libpp/format_output.h
277@@ -227,7 +227,7 @@ private:
278 class xml_formatter : public formatter {
279 public:
280 /// build a ready to use formatter
281- xml_formatter(profile_container const & profile,
282+ xml_formatter(profile_container const * profile,
283 symbol_collection & symbols);
284
285 // output body of XML output
286@@ -235,9 +235,9 @@ public:
287
288 /** output one symbol symb to out according to the output format
289 * specifier previously set by call(s) to add_format() */
290- void output_symbol(std::ostream & out,
291- symbol_collection::const_iterator const it,
292- size_t lo, size_t hi);
293+ virtual void output_symbol(std::ostream & out,
294+ symbol_entry const * symb, size_t lo, size_t hi,
295+ bool is_module);
296
297 /// output details for the symbol
298 std::string output_symbol_details(symbol_entry const * symb,
299@@ -246,9 +246,12 @@ public:
300 /// set the output_details boolean
301 void show_details(bool);
302
303+ // output SymbolData XML elements
304+ void output_symbol_data(std::ostream & out);
305+
306 private:
307 /// container we work from
308- profile_container const & profile;
309+ profile_container const * profile;
310
311 // ordered collection of symbols associated with this profile
312 symbol_collection & symbols;
313@@ -256,9 +259,6 @@ private:
314 /// true if we need to show details for each symbols
315 bool need_details;
316
317- // output SymbolData XML elements
318- void output_symbol_data(std::ostream & out);
319-
320 // count of DetailData items output so far
321 size_t detail_count;
322
323@@ -270,6 +270,30 @@ private:
324 format_flags fl, tag_t tag);
325 };
326
327+// callgraph XML output version
328+class xml_cg_formatter : public xml_formatter {
329+public:
330+ /// build a ready to use formatter
331+ xml_cg_formatter(callgraph_container const * callgraph,
332+ symbol_collection & symbols);
333+
334+ // output body of XML output
335+ void output(std::ostream & out);
336+
337+ /** output one symbol symb to out according to the output format
338+ * specifier previously set by call(s) to add_format() */
339+ virtual void output_symbol(std::ostream & out,
340+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module);
341+
342+private:
343+ /// container we work from
344+ callgraph_container const * callgraph;
345+
346+ void output_symbol_core(std::ostream & out,
347+ cg_symbol::children const cg_symb,
348+ std::string const selfname, std::string const qname,
349+ size_t lo, size_t hi, bool is_module, tag_t tag);
350+};
351
352 } // namespace format_output
353
354Index: oprofile/libpp/xml_utils.cpp
355===================================================================
356--- oprofile.orig/libpp/xml_utils.cpp
357+++ oprofile/libpp/xml_utils.cpp
358@@ -268,13 +268,6 @@ void xml_utils::output_xml_header(string
359 cout << close_element(SETUP) << endl;
360 }
361
362-size_t xml_utils::get_symbol_index(sym_iterator const it)
363-{
364- return it - symbols_begin;
365-}
366-
367-
368-
369 class subclass_info_t {
370 public:
371 string unitmask;
372@@ -443,7 +436,7 @@ public:
373 bool is_closed(string const & n);
374 protected:
375 void output_summary(ostream & out);
376- void output_symbols(ostream & out);
377+ void output_symbols(ostream & out, bool is_module);
378
379 string name;
380 sym_iterator begin;
381@@ -593,7 +586,7 @@ void module_info::output(ostream & out)
382 out << open_element(MODULE, true);
383 out << init_attr(NAME, name) << close_element(NONE, true);
384 output_summary(out);
385- output_symbols(out);
386+ output_symbols(out, true);
387 out << close_element(MODULE);
388 }
389
390@@ -605,13 +598,13 @@ void module_info::output_summary(ostream
391 }
392
393
394-void module_info::output_symbols(ostream & out)
395+void module_info::output_symbols(ostream & out, bool is_module)
396 {
397 if (begin == (sym_iterator)0)
398 return;
399
400 for (sym_iterator it = begin; it != end; ++it)
401- xml_out->output_symbol(out, it, lo, hi);
402+ xml_out->output_symbol(out, *it, lo, hi, is_module);
403 }
404
405
406@@ -791,7 +784,7 @@ void binary_info::output(ostream & out)
407 out << init_attr(NAME, name) << close_element(NONE, true);
408
409 output_summary(out);
410- output_symbols(out);
411+ output_symbols(out, false);
412 for (size_t a = 0; a < nr_modules; ++a)
413 my_modules[a].output(out);
414
415Index: oprofile/libutil++/xml_output.cpp
416===================================================================
417--- oprofile.orig/libutil++/xml_output.cpp
418+++ oprofile/libutil++/xml_output.cpp
419@@ -47,8 +47,11 @@ string const xml_tag_map[] = {
420 "binary",
421 "module",
422 "name",
423+ "callers",
424+ "callees",
425 "symbol",
426 "idref",
427+ "self",
428 "detaillo",
429 "detailhi",
430 "symboltable",
431Index: oprofile/libutil++/xml_output.h
432===================================================================
433--- oprofile.orig/libutil++/xml_output.h
434+++ oprofile/libutil++/xml_output.h
435@@ -28,7 +28,8 @@ typedef enum {
436 THREAD, THREAD_ID,
437 BINARY,
438 MODULE, NAME,
439- SYMBOL, ID_REF, DETAIL_LO, DETAIL_HI,
440+ CALLERS, CALLEES,
441+ SYMBOL, ID_REF, SELFREF, DETAIL_LO, DETAIL_HI,
442 SYMBOL_TABLE,
443 SYMBOL_DATA, STARTING_ADDR,
444 SOURCE_FILE, SOURCE_LINE, CODE_LENGTH,
445Index: oprofile/pp/opreport.cpp
446===================================================================
447--- oprofile.orig/pp/opreport.cpp
448+++ oprofile/pp/opreport.cpp
449@@ -378,7 +378,7 @@ void output_symbols(profile_container co
450 format_output::opreport_formatter * text_out = 0;
451
452 if (options::xml) {
453- xml_out = new format_output::xml_formatter(pc, symbols);
454+ xml_out = new format_output::xml_formatter(&pc, symbols);
455 xml_out->show_details(options::details);
456 out = xml_out;
457 // for XML always output long filenames
458@@ -450,21 +450,40 @@ void output_cg_symbols(callgraph_contain
459 options::sort_by.sort(symbols, options::reverse_sort,
460 options::long_filenames);
461
462- format_output::cg_formatter out(cg);
463+ format_output::formatter * out;
464+ format_output::xml_cg_formatter * xml_out = 0;
465+ format_output::cg_formatter * text_out = 0;
466
467- out.set_nr_classes(nr_classes);
468- out.show_long_filenames(options::long_filenames);
469- out.show_header(options::show_header);
470- out.vma_format_64bit(output_hints & cf_64bit_vma);
471- out.show_global_percent(options::global_percent);
472+ if (options::xml) {
473+ xml_out = new format_output::xml_cg_formatter(&cg, symbols);
474+ out = xml_out;
475+ // for XML always output long filenames
476+ out->show_long_filenames(true);
477+ } else {
478+ text_out = new format_output::cg_formatter(cg);
479+ out = text_out;
480+ out->show_long_filenames(options::long_filenames);
481+ }
482+
483+ out->set_nr_classes(nr_classes);
484+ out->show_header(options::show_header);
485+ out->vma_format_64bit(output_hints & cf_64bit_vma);
486+ out->show_global_percent(options::global_percent);
487
488 format_flags flags = get_format_flags(output_hints);
489 if (multiple_apps)
490 flags = format_flags(flags | ff_app_name);
491
492- out.add_format(flags);
493+ out->add_format(flags);
494+
495+ if (options::xml) {
496+ xml_support = new xml_utils(xml_out, symbols, nr_classes,
497+ &options::symbol_filter, options::archive_path);
498+ xml_out->output(cout);
499+ } else {
500+ text_out->output(cout, symbols);
501+ }
502
503- out.output(cout, symbols);
504 }
505
506
507Index: oprofile/pp/opreport_options.cpp
508===================================================================
509--- oprofile.orig/pp/opreport_options.cpp
510+++ oprofile/pp/opreport_options.cpp
511@@ -177,11 +177,6 @@ void check_options(bool diff)
512 }
513
514 if (xml) {
515- if (callgraph) {
516- cerr << "--callgraph is incompatible with --xml" << endl;
517- do_exit = true;
518- }
519-
520 if (accumulated) {
521 cerr << "--accumulated is incompatible with --xml" << endl;
522 do_exit = true;
523Index: oprofile/ChangeLog
524===================================================================
525--- oprofile.orig/ChangeLog
526+++ oprofile/ChangeLog
527@@ -1,5 +1,15 @@
528 2007-05-09 Richard Purdie <rpurdie@openedhand.com>
529
530+ * libpp/format_output.cpp:
531+ * libpp/format_output.h:
532+ * libpp/xml_utils.cpp:
533+ * libutil++/xml_output.cpp:
534+ * libutil++/xml_output.h:
535+ * pp/opreport.cpp:
536+ * pp/opreport_options.cpp: Add callgraph XML output
537+
538+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
539+
540 * libpp/callgraph_container.cpp:
541 * libpp/callgraph_container.h:
542 * libpp/format_output.cpp:
diff --git a/meta/packages/oprofile/oprofile/xscale_events.patch b/meta/packages/oprofile/oprofile/xscale_events.patch
new file mode 100644
index 0000000000..7f5d1f2bd0
--- /dev/null
+++ b/meta/packages/oprofile/oprofile/xscale_events.patch
@@ -0,0 +1,39 @@
1---
2 events/arm/xscale1/events | 8 ++++++--
3 events/arm/xscale2/events | 8 ++++++--
4 2 files changed, 12 insertions(+), 4 deletions(-)
5
6Index: oprofile/events/arm/xscale1/events
7===================================================================
8--- oprofile.orig/events/arm/xscale1/events 2004-04-06 05:32:22.000000000 +0100
9+++ oprofile/events/arm/xscale1/events 2007-05-23 13:37:04.000000000 +0100
10@@ -14,6 +14,10 @@ event:0x0a counters:1,2 um:zero minimum:
11 event:0x0b counters:1,2 um:zero minimum:500 name:DCACHE_MISS : data cache miss
12 event:0x0c counters:1,2 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline
13 event:0x0d counters:1,2 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch
14+event:0x10 counters:1,2 um:zero minimum:500 name:BCU_REQUEST : number of time the BCU received a new memory request from the core
15+event:0x11 counters:1,2 um:zero minimum:500 name:BCU_FULL : number of cycles the BCUs request queue is full
16+event:0x12 counters:1,2 um:zero minimum:500 name:BCU_DRAIN : number of times the BCU queues were drained due to a Drain Write Buffer command or an I/O transaction on a non-cacheable and non-bufferable page
17+event:0x14 counters:1,2 um:zero minimum:500 name:BCU_ECC_NO_ELOG : number of times the BCU detected an ECC error, but no ELOG register was available in which to log the error
18+event:0x15 counters:1,2 um:zero minimum:500 name:BCU_1_BIT_ERR : number of times the BCU detected a 1-bit error while reading data from the bus
19+event:0x16 counters:1,2 um:zero minimum:500 name:RMW : number of times an RMW cycle occurred due to narrow write on ECC-protected memory
20 event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
21-#0x10 through 0x17 Defined by ASSP. See the Intel® XScale" core implementation option section of the ASSP
22-#architecture specification for more details.
23Index: oprofile/events/arm/xscale2/events
24===================================================================
25--- oprofile.orig/events/arm/xscale2/events 2004-04-06 05:32:23.000000000 +0100
26+++ oprofile/events/arm/xscale2/events 2007-05-23 13:37:34.000000000 +0100
27@@ -14,6 +14,10 @@ event:0x0a counters:1,2,3,4 um:zero mini
28 event:0x0b counters:1,2,3,4 um:zero minimum:500 name:DCACHE_MISS : data cache miss
29 event:0x0c counters:1,2,3,4 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline
30 event:0x0d counters:1,2,3,4 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch
31+event:0x10 counters:1,2,3,4 um:zero minimum:500 name:BCU_REQUEST : number of time the BCU received a new memory request from the core
32+event:0x11 counters:1,2,3,4 um:zero minimum:500 name:BCU_FULL : number of cycles the BCUs request queue is full
33+event:0x12 counters:1,2,3,4 um:zero minimum:500 name:BCU_DRAIN : number of times the BCU queues were drained due to a Drain Write Buffer command or an I/O transaction on a non-cacheable and non-bufferable page
34+event:0x14 counters:1,2,3,4 um:zero minimum:500 name:BCU_ECC_NO_ELOG : number of times the BCU detected an ECC error, but no ELOG register was available in which to log the error
35+event:0x15 counters:1,2,3,4 um:zero minimum:500 name:BCU_1_BIT_ERR : number of times the BCU detected a 1-bit error while reading data from the bus
36+event:0x16 counters:1,2,3,4 um:zero minimum:500 name:RMW : number of times an RMW cycle occurred due to narrow write on ECC-protected memory
37 event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter
38-#0x10 through 0x17 Defined by ASSP. See the Intel® XScale" core implementation option section of the ASSP
39-#architecture specification for more details.
diff --git a/meta/packages/oprofile/oprofile_cvs.bb b/meta/packages/oprofile/oprofile_cvs.bb
index dab1f093a5..55bfa97fda 100644
--- a/meta/packages/oprofile/oprofile_cvs.bb
+++ b/meta/packages/oprofile/oprofile_cvs.bb
@@ -1,5 +1,5 @@
1PV = "0.9.2+cvs${SRCDATE}" 1PV = "0.9.2+cvs${SRCDATE}"
2PR = "r4" 2PR = "r5"
3SECTION = "devel" 3SECTION = "devel"
4DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \ 4DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \
5of profiling all running code at low overhead." 5of profiling all running code at low overhead."
@@ -7,11 +7,9 @@ LICENSE = "GPL"
7DEPENDS = "popt binutils" 7DEPENDS = "popt binutils"
8 8
9SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=oprofile \ 9SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=oprofile \
10 file://oprofile_eabi.patch;patch=1 \
11 file://oparchive-debug-dir.patch;patch=1 \ 10 file://oparchive-debug-dir.patch;patch=1 \
12 file://oparchive-list-files.patch;patch=1 \ 11 file://armv6_events.patch;patch=1 \
13 file://cg_collection.patch;patch=1 \ 12 file://xscale_events.patch;patch=1 \
14 file://xml_callgraph.patch;patch=1 \
15 file://acinclude.m4" 13 file://acinclude.m4"
16S = "${WORKDIR}/oprofile" 14S = "${WORKDIR}/oprofile"
17 15