summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-05-09 16:11:18 +0000
committerRichard Purdie <richard@openedhand.com>2007-05-09 16:11:18 +0000
commit1d87eb3ff2bab5d0a4aeb0208bc87412f9348237 (patch)
tree5c6f808f288cd7185e82241316b0ba5afe5543e7
parentc91e54338f7d6015b361194efc603858d1294076 (diff)
downloadpoky-1d87eb3ff2bab5d0a4aeb0208bc87412f9348237.tar.gz
oprofile: Update patches
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1637 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r--meta/packages/oprofile/oprofile/cg_collection.patch289
-rw-r--r--meta/packages/oprofile/oprofile/oparchive-debug-dir.patch42
-rw-r--r--meta/packages/oprofile/oprofile/oparchive-list-files.patch71
-rw-r--r--meta/packages/oprofile/oprofile/oprofile_eabi.patch12
-rw-r--r--meta/packages/oprofile/oprofile/xml_callgraph.patch296
-rw-r--r--meta/packages/oprofile/oprofile_cvs.bb3
6 files changed, 445 insertions, 268 deletions
diff --git a/meta/packages/oprofile/oprofile/cg_collection.patch b/meta/packages/oprofile/oprofile/cg_collection.patch
new file mode 100644
index 0000000000..a87ec72477
--- /dev/null
+++ b/meta/packages/oprofile/oprofile/cg_collection.patch
@@ -0,0 +1,289 @@
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/oparchive-debug-dir.patch b/meta/packages/oprofile/oprofile/oparchive-debug-dir.patch
index 43a4bbd8c7..ab925c9048 100644
--- a/meta/packages/oprofile/oprofile/oparchive-debug-dir.patch
+++ b/meta/packages/oprofile/oprofile/oparchive-debug-dir.patch
@@ -2,7 +2,21 @@ Index: oprofile/pp/oparchive.cpp
2=================================================================== 2===================================================================
3--- oprofile.orig/pp/oparchive.cpp 3--- oprofile.orig/pp/oparchive.cpp
4+++ oprofile/pp/oparchive.cpp 4+++ oprofile/pp/oparchive.cpp
5@@ -97,8 +97,17 @@ int oparchive(options::spec const & spec 5@@ -84,9 +84,10 @@ int oparchive(options::spec const & spec
6 exe_archive_file);
7
8 /* If there are any debuginfo files, copy them over.
9- * Need to copy the debug info file in the same
10- * directory as the executable. The /usr/lib/debug
11- * search path is not going to work.
12+ * Need to copy the debug info file to somewhere we'll
13+ * find it - executable location + "/.debug"
14+ * to avoid overwriting files with the same name. The
15+ * /usr/lib/debug search path is not going to work.
16 */
17 bfd * ibfd = open_bfd(exe_name);
18 if (ibfd) {
19@@ -97,8 +98,15 @@ int oparchive(options::spec const & spec
6 if (find_separate_debug_file(ibfd, dirname, global, 20 if (find_separate_debug_file(ibfd, dirname, global,
7 debug_filename)) { 21 debug_filename)) {
8 /* found something copy it over */ 22 /* found something copy it over */
@@ -10,15 +24,29 @@ Index: oprofile/pp/oparchive.cpp
10- dirname + "/" + 24- dirname + "/" +
11+ string dest_debug_dir = options::outdirectory + 25+ string dest_debug_dir = options::outdirectory +
12+ dirname + "/.debug/"; 26+ dirname + "/.debug/";
13+ if (mkdir(dest_debug_dir.c_str(),0755) < 0) { 27+ if (create_dir(dest_debug_dir.c_str())) {
14+ if (errno!=EEXIST) { 28+ cerr << "Unable to create directory: "
15+ cerr << "Unable to create directory: " 29+ << dest_debug_dir << "." << endl;
16+ << dest_debug_dir << "." << endl; 30+ exit (EXIT_FAILURE);
17+ exit (EXIT_FAILURE);
18+ }
19+ } 31+ }
20+ 32+
21+ string dest_debug = dest_debug_dir + 33+ string dest_debug = dest_debug_dir +
22 op_basename(debug_filename); 34 op_basename(debug_filename);
23 copy_one_file(image_ok, debug_filename, dest_debug); 35 copy_one_file(image_ok, debug_filename, dest_debug);
24 } 36 }
37Index: oprofile/ChangeLog
38===================================================================
39--- oprofile.orig/ChangeLog
40+++ oprofile/ChangeLog
41@@ -1,5 +1,11 @@
42 2007-05-09 Richard Purdie <rpurdie@openedhand.com>
43
44+ * oprofile/pp/oparchive.cpp: If the debug files have the same name
45+ as the original binary, the binary gets overwritten. Add in a .debug
46+ directory to avoid this.
47+
48+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
49+
50 * oprofile/daemon/opd_cookie.c: Fix syscall for ARM EABI
51
52 2007-04-25 Manoj Ekbote <manoj.ekbote@broadcom.com>
diff --git a/meta/packages/oprofile/oprofile/oparchive-list-files.patch b/meta/packages/oprofile/oprofile/oparchive-list-files.patch
index 93cf3cdb8d..8d92efead6 100644
--- a/meta/packages/oprofile/oprofile/oparchive-list-files.patch
+++ b/meta/packages/oprofile/oprofile/oparchive-list-files.patch
@@ -14,6 +14,45 @@ Index: oprofile/pp/oparchive.cpp
14 if (!copy_file(source, dest) && err == image_ok) { 14 if (!copy_file(source, dest) && err == image_ok) {
15 cerr << "can't copy from " << source << " to " << dest 15 cerr << "can't copy from " << source << " to " << dest
16 << " cause: " << strerror(errno) << endl; 16 << " cause: " << strerror(errno) << endl;
17@@ -46,7 +51,7 @@ int oparchive(options::spec const & spec
18 handle_options(spec);
19
20 /* Check to see if directory can be created */
21- if (create_path(options::outdirectory.c_str())) {
22+ if (!options::list_files && create_path(options::outdirectory.c_str())) {
23 cerr << "Unable to create directory for "
24 << options::outdirectory << "." << endl;
25 exit (EXIT_FAILURE);
26@@ -73,7 +78,8 @@ int oparchive(options::spec const & spec
27
28 cverb << vdebug << exe_name << endl;
29 /* Create directory for executable file. */
30- if (create_path(exe_archive_file.c_str())) {
31+ if (!options::list_files
32+ && create_path(exe_archive_file.c_str())) {
33 cerr << "Unable to create directory for "
34 << exe_archive_file << "." << endl;
35 exit (EXIT_FAILURE);
36@@ -100,7 +106,8 @@ int oparchive(options::spec const & spec
37 /* found something copy it over */
38 string dest_debug_dir = options::outdirectory +
39 dirname + "/.debug/";
40- if (create_dir(dest_debug_dir.c_str())) {
41+ if (!options::list_files
42+ && create_dir(dest_debug_dir.c_str())) {
43 cerr << "Unable to create directory: "
44 << dest_debug_dir << "." << endl;
45 exit (EXIT_FAILURE);
46@@ -130,7 +137,8 @@ int oparchive(options::spec const & spec
47
48 cverb << vdebug << (sample_name) << endl;
49 cverb << vdebug << " destp " << sample_archive_file << endl;
50- if (create_path(sample_archive_file.c_str())) {
51+ if (!options::list_files
52+ && create_path(sample_archive_file.c_str())) {
53 cerr << "Unable to create directory for "
54 << sample_archive_file << "." << endl;
55 exit (EXIT_FAILURE);
17Index: oprofile/pp/oparchive_options.cpp 56Index: oprofile/pp/oparchive_options.cpp
18=================================================================== 57===================================================================
19--- oprofile.orig/pp/oparchive_options.cpp 58--- oprofile.orig/pp/oparchive_options.cpp
@@ -58,3 +97,35 @@ Index: oprofile/pp/oparchive_options.h
58 } 97 }
59 98
60 /// All the chosen sample files. 99 /// All the chosen sample files.
100Index: oprofile/ChangeLog
101===================================================================
102--- oprofile.orig/ChangeLog
103+++ oprofile/ChangeLog
104@@ -1,5 +1,12 @@
105 2007-05-09 Richard Purdie <rpurdie@openedhand.com>
106
107+ * oparchive.cpp:
108+ * oparchive_options.cpp:
109+ * oparchive_options.h: Add --list-files option to list all files that
110+ would be handled by oparchive.
111+
112+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
113+
114 * oprofile/pp/oparchive.cpp: If the debug files have the same name
115 as the original binary, the binary gets overwritten. Add in a .debug
116 directory to avoid this.
117Index: oprofile/doc/oparchive.1.in
118===================================================================
119--- oprofile.orig/doc/oparchive.1.in
120+++ oprofile/doc/oparchive.1.in
121@@ -50,6 +50,10 @@ Output to the given directory. There is
122 Do not include application-specific images for libraries, kernel modules
123 and the kernel. This option only makes sense if the profile session
124 used --separate.
125+.br
126+.TP
127+.BI "--list-files / -l"
128+Only list the files that would be archived, don't copy them.
129
130 .SH ENVIRONMENT
131 No special environment variables are recognised by oparchive.
diff --git a/meta/packages/oprofile/oprofile/oprofile_eabi.patch b/meta/packages/oprofile/oprofile/oprofile_eabi.patch
index 7388deef3e..2ae269f867 100644
--- a/meta/packages/oprofile/oprofile/oprofile_eabi.patch
+++ b/meta/packages/oprofile/oprofile/oprofile_eabi.patch
@@ -16,3 +16,15 @@ Index: oprofile/daemon/opd_cookie.c
16 static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size) 16 static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
17 { 17 {
18 return syscall(__NR_lookup_dcookie, 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
index 1ffe6f69b2..f089e7dc4a 100644
--- a/meta/packages/oprofile/oprofile/xml_callgraph.patch
+++ b/meta/packages/oprofile/oprofile/xml_callgraph.patch
@@ -1,162 +1,18 @@
1--- 1 ChangeLog | 10 ++
2 libpp/callgraph_container.cpp | 22 ++- 2 libpp/format_output.cpp | 178 +++++++++++++++++++++++++++++++++++++++++------
3 libpp/callgraph_container.h | 7 - 3 libpp/format_output.h | 40 ++++++++--
4 libpp/format_output.cpp | 245 ++++++++++++++++++++++++++++++++++++------ 4 libpp/xml_utils.cpp | 17 +---
5 libpp/format_output.h | 41 +++++-- 5 libutil++/xml_output.cpp | 3
6 libpp/symbol.h | 15 +- 6 libutil++/xml_output.h | 3
7 libpp/symbol_sort.cpp | 17 -- 7 pp/opreport.cpp | 37 +++++++--
8 libpp/symbol_sort.h | 6 - 8 pp/opreport_options.cpp | 5 -
9 libpp/xml_utils.cpp | 17 -- 9 8 files changed, 238 insertions(+), 55 deletions(-)
10 libutil++/xml_output.cpp | 3 10
11 libutil++/xml_output.h | 3
12 pp/opreport.cpp | 40 +++++-
13 pp/opreport_options.cpp | 5
14 12 files changed, 314 insertions(+), 107 deletions(-)
15 11
16Index: oprofile/libpp/callgraph_container.cpp
17===================================================================
18--- oprofile.orig/libpp/callgraph_container.cpp
19+++ oprofile/libpp/callgraph_container.cpp
20@@ -379,12 +379,15 @@ process(count_array_t total, double thre
21
22 process_children(sym, threshold);
23
24- cg_syms.push_back(sym);
25+ cg_syms_objs.push_back(sym);
26 }
27+
28+ for (unsigned int i = 0; i < cg_syms_objs.size(); i++)
29+ cg_syms.push_back(&cg_syms_objs[i]);
30 }
31
32
33-cg_collection arc_recorder::get_symbols() const
34+symbol_collection arc_recorder::get_symbols() const
35 {
36 return cg_syms;
37 }
38@@ -580,12 +583,14 @@ column_flags callgraph_container::output
39 column_flags output_hints = cf_none;
40
41 // FIXME: costly: must we access directly recorder map ?
42- cg_collection syms = recorder.get_symbols();
43+ symbol_collection syms = recorder.get_symbols();
44
45- cg_collection::const_iterator it;
46- cg_collection::const_iterator const end = syms.end();
47- for (it = syms.begin(); it != end; ++it)
48- output_hints = it->output_hint(output_hints);
49+ symbol_collection::iterator it;
50+ symbol_collection::iterator const end = syms.end();
51+ for (it = syms.begin(); it != end; ++it) {
52+ cg_symbol const *cg_symb = dynamic_cast<const cg_symbol *>(*it);
53+ output_hints = cg_symb->output_hint(output_hints);
54+ }
55
56 return output_hints;
57 }
58@@ -597,7 +602,7 @@ count_array_t callgraph_container::sampl
59 }
60
61
62-cg_collection callgraph_container::get_symbols() const
63+symbol_collection callgraph_container::get_symbols() const
64 {
65 return recorder.get_symbols();
66 }
67Index: oprofile/libpp/callgraph_container.h
68===================================================================
69--- oprofile.orig/libpp/callgraph_container.h
70+++ oprofile/libpp/callgraph_container.h
71@@ -53,7 +53,7 @@ public:
72 count_array_t const & arc_count);
73
74 /// return all the cg symbols
75- cg_collection get_symbols() const;
76+ symbol_collection get_symbols() const;
77
78 /**
79 * After population, build the final output, and do
80@@ -91,7 +91,8 @@ private:
81 map_t sym_map;
82
83 /// final output data
84- cg_collection cg_syms;
85+ symbol_collection cg_syms;
86+ cg_collection_objs cg_syms_objs;
87 };
88
89
90@@ -126,7 +127,7 @@ public:
91 count_array_t samples_count() const;
92
93 // return all the cg symbols
94- cg_collection get_symbols() const;
95+ symbol_collection get_symbols() const;
96
97 private:
98 /**
99Index: oprofile/libpp/format_output.cpp 12Index: oprofile/libpp/format_output.cpp
100=================================================================== 13===================================================================
101--- oprofile.orig/libpp/format_output.cpp 14--- oprofile.orig/libpp/format_output.cpp
102+++ oprofile/libpp/format_output.cpp 15+++ oprofile/libpp/format_output.cpp
103@@ -489,7 +489,7 @@ cg_formatter::cg_formatter(callgraph_con
104 }
105
106
107-void cg_formatter::output(ostream & out, cg_collection const & syms)
108+void cg_formatter::output(ostream & out, symbol_collection const & syms)
109 {
110 // amount of spacing prefixing child and parent lines
111 string const child_parent_prefix(" ");
112@@ -498,37 +498,37 @@ void cg_formatter::output(ostream & out,
113
114 out << string(79, '-') << endl;
115
116- cg_collection::const_iterator it;
117- cg_collection::const_iterator end = syms.end();
118+ symbol_collection::const_iterator it;
119+ symbol_collection::const_iterator end = syms.end();
120
121 for (it = syms.begin(); it < end; ++it) {
122- cg_symbol const & sym = *it;
123+ cg_symbol const *sym = dynamic_cast<const cg_symbol *>(*it);
124
125 cg_symbol::children::const_iterator cit;
126- cg_symbol::children::const_iterator cend = sym.callers.end();
127+ cg_symbol::children::const_iterator cend = sym->callers.end();
128
129 counts_t c;
130 if (global_percent)
131 c.total = counts.total;
132 else
133- c.total = sym.total_caller_count;
134+ c.total = sym->total_caller_count;
135
136- for (cit = sym.callers.begin(); cit != cend; ++cit) {
137+ for (cit = sym->callers.begin(); cit != cend; ++cit) {
138 out << child_parent_prefix;
139 do_output(out, *cit, cit->sample, c);
140 }
141
142- do_output(out, sym, sym.sample, counts);
143+ do_output(out, *sym, sym->sample, counts);
144
145 c = counts_t();
146 if (global_percent)
147 c.total = counts.total;
148 else
149- c.total = sym.total_callee_count;
150+ c.total = sym->total_callee_count;
151
152- cend = sym.callees.end();
153+ cend = sym->callees.end();
154
155- for (cit = sym.callees.begin(); cit != cend; ++cit) {
156+ for (cit = sym->callees.begin(); cit != cend; ++cit) {
157 out << child_parent_prefix;
158 do_output(out, *cit, cit->sample, c);
159 }
160@@ -562,6 +562,20 @@ ostringstream bytes_out; 16@@ -562,6 +562,20 @@ ostringstream bytes_out;
161 map<string, size_t> symbol_data_table; 17 map<string, size_t> symbol_data_table;
162 size_t symbol_data_index = 0; 18 size_t symbol_data_index = 0;
@@ -306,7 +162,7 @@ Index: oprofile/libpp/format_output.cpp
306+} 162+}
307+ 163+
308+void xml_cg_formatter:: 164+void xml_cg_formatter::
309+output_symbol_core(ostream & out, cg_symbol::children const cg_symb, 165+output_symbol_core(ostream & out, cg_symbol::children const cg_symb,
310+ string const selfname, string const qname, 166+ string const selfname, string const qname,
311+ size_t lo, size_t hi, bool is_module, tag_t tag) 167+ size_t lo, size_t hi, bool is_module, tag_t tag)
312+{ 168+{
@@ -338,7 +194,7 @@ Index: oprofile/libpp/format_output.cpp
338+ 194+
339+ string const symname = symbol_names.name(cit->name); 195+ string const symname = symbol_names.name(cit->name);
340+ assert(symname.size() > 0); 196+ assert(symname.size() > 0);
341+ 197+
342+ string const symqname = module + ":" + symname; 198+ string const symqname = module + ":" + symname;
343+ 199+
344+ // Find any self references and handle 200+ // Find any self references and handle
@@ -387,7 +243,7 @@ Index: oprofile/libpp/format_output.cpp
387+ 243+
388+ string const name = symbol_names.name(symb->name); 244+ string const name = symbol_names.name(symb->name);
389+ assert(name.size() > 0); 245+ assert(name.size() > 0);
390+ 246+
391+ string const image = get_image_name(symb->image_name, true); 247+ string const image = get_image_name(symb->image_name, true);
392+ string const qname = image + ":" + name; 248+ string const qname = image + ":" + name;
393+ 249+
@@ -418,15 +274,6 @@ Index: oprofile/libpp/format_output.h
418=================================================================== 274===================================================================
419--- oprofile.orig/libpp/format_output.h 275--- oprofile.orig/libpp/format_output.h
420+++ oprofile/libpp/format_output.h 276+++ oprofile/libpp/format_output.h
421@@ -201,7 +201,7 @@ public:
422
423 /** output callgraph information according to the previously format
424 * specifier set by call(s) to add_format() */
425- void output(std::ostream & out, cg_collection const & syms);
426+ void output(std::ostream & out, symbol_collection const & syms);
427 };
428
429 /// class to output a columned format symbols plus diff values
430@@ -227,7 +227,7 @@ private: 277@@ -227,7 +227,7 @@ private:
431 class xml_formatter : public formatter { 278 class xml_formatter : public formatter {
432 public: 279 public:
@@ -496,99 +343,14 @@ Index: oprofile/libpp/format_output.h
496+ /// container we work from 343+ /// container we work from
497+ callgraph_container const * callgraph; 344+ callgraph_container const * callgraph;
498+ 345+
499+ void output_symbol_core(std::ostream & out, 346+ void output_symbol_core(std::ostream & out,
500+ cg_symbol::children const cg_symb, 347+ cg_symbol::children const cg_symb,
501+ std::string const selfname, std::string const qname, 348+ std::string const selfname, std::string const qname,
502+ size_t lo, size_t hi, bool is_module, tag_t tag); 349+ size_t lo, size_t hi, bool is_module, tag_t tag);
503+}; 350+};
504 351
505 } // namespace format_output 352 } // namespace format_output
506 353
507Index: oprofile/libpp/symbol.h
508===================================================================
509--- oprofile.orig/libpp/symbol.h
510+++ oprofile/libpp/symbol.h
511@@ -56,8 +56,11 @@ struct sample_entry {
512
513
514 /// associate a symbol with a file location, samples count and vma address
515-struct symbol_entry {
516+class symbol_entry {
517+public:
518 symbol_entry() : size(0) {}
519+ virtual ~symbol_entry() {}
520+
521 /// which image this symbol belongs to
522 image_name_id image_name;
523 /// owning application name: identical to image name if profiling
524@@ -93,7 +96,8 @@ typedef std::vector<symbol_entry const *
525 * the sample counts replaced with the relevant arc counts, whilst
526 * the cg_symbol retains its self count.
527 */
528-struct cg_symbol : public symbol_entry {
529+class cg_symbol : public symbol_entry {
530+public:
531 cg_symbol(symbol_entry const & sym) : symbol_entry(sym) {}
532
533 typedef std::vector<symbol_entry> children;
534@@ -109,10 +113,8 @@ struct cg_symbol : public symbol_entry {
535 count_array_t total_callee_count;
536 };
537
538-
539-/// a collection of sorted callgraph symbols
540-typedef std::vector<cg_symbol> cg_collection;
541-
542+/// a collection of sorted callgraph symbol objects
543+typedef std::vector<cg_symbol> cg_collection_objs;
544
545 /// for storing diff %ages
546 typedef growable_vector<double> diff_array_t;
547Index: oprofile/libpp/symbol_sort.cpp
548===================================================================
549--- oprofile.orig/libpp/symbol_sort.cpp
550+++ oprofile/libpp/symbol_sort.cpp
551@@ -146,23 +146,6 @@ sort(symbol_collection & syms, bool reve
552
553
554 void sort_options::
555-sort(cg_collection & syms, bool reverse_sort, bool lf) const
556-{
557- long_filenames = lf;
558-
559- vector<sort_order> sort_option(options);
560- for (sort_order cur = first; cur != last; cur = sort_order(cur + 1)) {
561- if (find(sort_option.begin(), sort_option.end(), cur) ==
562- sort_option.end())
563- sort_option.push_back(cur);
564- }
565-
566- stable_sort(syms.begin(), syms.end(),
567- symbol_compare(sort_option, reverse_sort));
568-}
569-
570-
571-void sort_options::
572 sort(diff_collection & syms, bool reverse_sort, bool lf) const
573 {
574 long_filenames = lf;
575Index: oprofile/libpp/symbol_sort.h
576===================================================================
577--- oprofile.orig/libpp/symbol_sort.h
578+++ oprofile/libpp/symbol_sort.h
579@@ -44,12 +44,6 @@ struct sort_options {
580 /**
581 * Sort the given container by the given criteria.
582 */
583- void sort(cg_collection & syms, bool reverse_sort,
584- bool long_filenames) const;
585-
586- /**
587- * Sort the given container by the given criteria.
588- */
589 void sort(diff_collection & syms, bool reverse_sort,
590 bool long_filenames) const;
591
592Index: oprofile/libpp/xml_utils.cpp 354Index: oprofile/libpp/xml_utils.cpp
593=================================================================== 355===================================================================
594--- oprofile.orig/libpp/xml_utils.cpp 356--- oprofile.orig/libpp/xml_utils.cpp
@@ -693,13 +455,7 @@ Index: oprofile/pp/opreport.cpp
693 xml_out->show_details(options::details); 455 xml_out->show_details(options::details);
694 out = xml_out; 456 out = xml_out;
695 // for XML always output long filenames 457 // for XML always output long filenames
696@@ -445,25 +445,45 @@ void output_cg_symbols(callgraph_contain 458@@ -450,21 +450,40 @@ void output_cg_symbols(callgraph_contain
697 {
698 column_flags output_hints = cg.output_hint();
699
700- cg_collection symbols = cg.get_symbols();
701+ symbol_collection symbols = cg.get_symbols();
702+
703 options::sort_by.sort(symbols, options::reverse_sort, 459 options::sort_by.sort(symbols, options::reverse_sort,
704 options::long_filenames); 460 options::long_filenames);
705 461
@@ -764,3 +520,23 @@ Index: oprofile/pp/opreport_options.cpp
764 if (accumulated) { 520 if (accumulated) {
765 cerr << "--accumulated is incompatible with --xml" << endl; 521 cerr << "--accumulated is incompatible with --xml" << endl;
766 do_exit = true; 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_cvs.bb b/meta/packages/oprofile/oprofile_cvs.bb
index b0ccc3ce61..dab1f093a5 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 = "r3" 2PR = "r4"
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."
@@ -10,6 +10,7 @@ SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=
10 file://oprofile_eabi.patch;patch=1 \ 10 file://oprofile_eabi.patch;patch=1 \
11 file://oparchive-debug-dir.patch;patch=1 \ 11 file://oparchive-debug-dir.patch;patch=1 \
12 file://oparchive-list-files.patch;patch=1 \ 12 file://oparchive-list-files.patch;patch=1 \
13 file://cg_collection.patch;patch=1 \
13 file://xml_callgraph.patch;patch=1 \ 14 file://xml_callgraph.patch;patch=1 \
14 file://acinclude.m4" 15 file://acinclude.m4"
15S = "${WORKDIR}/oprofile" 16S = "${WORKDIR}/oprofile"