summaryrefslogtreecommitdiffstats
path: root/meta/packages/oprofile/oprofile/xml_callgraph.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/oprofile/oprofile/xml_callgraph.patch')
-rw-r--r--meta/packages/oprofile/oprofile/xml_callgraph.patch296
1 files changed, 36 insertions, 260 deletions
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: