1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

oprofile: Improve xml_callgraph patch

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1290 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie
2007-02-22 17:54:09 +00:00
parent 1b447bc1c9
commit c269b41ea2
2 changed files with 114 additions and 56 deletions
@@ -1,7 +1,22 @@
---
libpp/callgraph_container.cpp | 22 ++-
libpp/callgraph_container.h | 7 -
libpp/format_output.cpp | 245 ++++++++++++++++++++++++++++++++++++------
libpp/format_output.h | 41 +++++--
libpp/symbol.h | 15 +-
libpp/symbol_sort.cpp | 17 --
libpp/symbol_sort.h | 6 -
libpp/xml_utils.cpp | 17 --
libutil++/xml_output.cpp | 3
libutil++/xml_output.h | 3
pp/opreport.cpp | 40 +++++-
pp/opreport_options.cpp | 5
12 files changed, 314 insertions(+), 107 deletions(-)
Index: oprofile/libpp/callgraph_container.cpp
===================================================================
--- oprofile.orig/libpp/callgraph_container.cpp
+++ oprofile/libpp/callgraph_container.cpp
--- oprofile.orig/libpp/callgraph_container.cpp 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libpp/callgraph_container.cpp 2007-02-22 18:19:12.000000000 +0000
@@ -379,17 +379,19 @@ process(count_array_t total, double thre
process_children(sym, threshold);
@@ -56,8 +71,8 @@ Index: oprofile/libpp/callgraph_container.cpp
}
Index: oprofile/libpp/callgraph_container.h
===================================================================
--- oprofile.orig/libpp/callgraph_container.h
+++ oprofile/libpp/callgraph_container.h
--- oprofile.orig/libpp/callgraph_container.h 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libpp/callgraph_container.h 2007-02-22 18:19:12.000000000 +0000
@@ -53,7 +53,7 @@ public:
count_array_t const & arc_count);
@@ -88,8 +103,8 @@ Index: oprofile/libpp/callgraph_container.h
/**
Index: oprofile/libpp/format_output.cpp
===================================================================
--- oprofile.orig/libpp/format_output.cpp
+++ oprofile/libpp/format_output.cpp
--- oprofile.orig/libpp/format_output.cpp 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libpp/format_output.cpp 2007-02-22 18:19:12.000000000 +0000
@@ -489,7 +489,7 @@ cg_formatter::cg_formatter(callgraph_con
}
@@ -226,20 +241,21 @@ Index: oprofile/libpp/format_output.cpp
ostringstream str;
for (; it != end; ++it) {
@@ -725,10 +742,10 @@ output_symbol_details(symbol_entry const
@@ -725,10 +742,11 @@ output_symbol_details(symbol_entry const
void xml_formatter::
output_symbol(ostream & out,
- symbol_collection::const_iterator const it, size_t lo, size_t hi)
+ symbol_entry const * symb, size_t lo, size_t hi)
+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module)
{
- symbol_entry const * symb = *it;
ostringstream str;
+ size_t indx;
+ // pointless reference to is_module, remove insane compiler warning
+ size_t indx = is_module ? 0 : 1;
// output symbol's summary data for each profile class
bool got_samples = false;
@@ -750,27 +767,21 @@ output_symbol(ostream & out,
@@ -750,27 +768,21 @@ output_symbol(ostream & out,
string const image = get_image_name(symb->image_name, true);
string const qname = image + ":" + name;
@@ -271,7 +287,7 @@ Index: oprofile/libpp/format_output.cpp
details << detail_str;
}
@@ -826,5 +837,170 @@ output_attribute(ostream & out, field_da
@@ -826,5 +838,176 @@ output_attribute(ostream & out, field_da
}
}
@@ -296,7 +312,7 @@ Index: oprofile/libpp/format_output.cpp
+
+void xml_cg_formatter::
+output_symbol_core(ostream & out,
+ symbol_entry const * symb, size_t lo, size_t hi)
+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module)
+{
+ cg_symbol const * cg_symb = dynamic_cast<const cg_symbol *>(symb);
+ ostringstream str;
@@ -348,11 +364,13 @@ Index: oprofile/libpp/format_output.cpp
+ if (!got_samples)
+ continue;
+
+ out << open_element(MODULE, true);
+ out << init_attr(NAME, module) << close_element(NONE, true);
+
+ cverb << vxml << " <!-- symbol_ref=" << symbol_names.name(cit->name) << " -->" << endl;
+
+ if (is_module) {
+ out << open_element(MODULE, true);
+ out << init_attr(NAME, module) << close_element(NONE, true);
+ }
+
+ out << open_element(SYMBOL, true);
+
+ string const name1 = symbol_names.name(cit->name);
@@ -368,7 +386,8 @@ Index: oprofile/libpp/format_output.cpp
+
+ out << close_element(SYMBOL);
+
+ out << close_element(MODULE);
+ if (is_module)
+ out << close_element(MODULE);
+ }
+ }
+ out << close_element(CALLERS);
@@ -394,11 +413,13 @@ Index: oprofile/libpp/format_output.cpp
+ if (!got_samples)
+ continue;
+
+ out << open_element(MODULE, true);
+ out << init_attr(NAME, module) << close_element(NONE, true);
+
+ cverb << vxml << " <!-- symbol_ref=" << symbol_names.name(cit->name) << " -->" << endl;
+
+ if (is_module) {
+ out << open_element(MODULE, true);
+ out << init_attr(NAME, module) << close_element(NONE, true);
+ }
+
+ out << open_element(SYMBOL, true);
+
+ string name1 = symbol_names.name(cit->name);
@@ -423,7 +444,8 @@ Index: oprofile/libpp/format_output.cpp
+
+ out << close_element(SYMBOL);
+
+ out << close_element(MODULE);
+ if (is_module)
+ out << close_element(MODULE);
+ }
+ }
+ out << close_element(CALLEES);
@@ -436,16 +458,16 @@ Index: oprofile/libpp/format_output.cpp
+
+void xml_cg_formatter::
+output_symbol(ostream & out,
+ symbol_entry const * symb, size_t lo, size_t hi)
+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module)
+{
+ output_symbol_core(out, symb, lo, hi);
+ output_symbol_core(out, symb, lo, hi, is_module);
+}
} // namespace format_output
Index: oprofile/libpp/format_output.h
===================================================================
--- oprofile.orig/libpp/format_output.h
+++ oprofile/libpp/format_output.h
--- oprofile.orig/libpp/format_output.h 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libpp/format_output.h 2007-02-22 18:19:12.000000000 +0000
@@ -201,7 +201,7 @@ public:
/** output callgraph information according to the previously format
@@ -464,7 +486,7 @@ Index: oprofile/libpp/format_output.h
symbol_collection & symbols);
// output body of XML output
@@ -235,9 +235,8 @@ public:
@@ -235,9 +235,9 @@ public:
/** output one symbol symb to out according to the output format
* specifier previously set by call(s) to add_format() */
@@ -472,11 +494,12 @@ Index: oprofile/libpp/format_output.h
- symbol_collection::const_iterator const it,
- size_t lo, size_t hi);
+ virtual void output_symbol(std::ostream & out,
+ symbol_entry const * symb, size_t lo, size_t hi);
+ symbol_entry const * symb, size_t lo, size_t hi,
+ bool is_module);
/// output details for the symbol
std::string output_symbol_details(symbol_entry const * symb,
@@ -246,9 +245,12 @@ public:
@@ -246,9 +246,12 @@ public:
/// set the output_details boolean
void show_details(bool);
@@ -490,7 +513,7 @@ Index: oprofile/libpp/format_output.h
// ordered collection of symbols associated with this profile
symbol_collection & symbols;
@@ -256,9 +258,6 @@ private:
@@ -256,9 +259,6 @@ private:
/// true if we need to show details for each symbols
bool need_details;
@@ -500,7 +523,7 @@ Index: oprofile/libpp/format_output.h
// count of DetailData items output so far
size_t detail_count;
@@ -270,6 +269,28 @@ private:
@@ -270,6 +270,29 @@ private:
format_flags fl, tag_t tag);
};
@@ -517,22 +540,23 @@ Index: oprofile/libpp/format_output.h
+ /** output one symbol symb to out according to the output format
+ * specifier previously set by call(s) to add_format() */
+ virtual void output_symbol(std::ostream & out,
+ symbol_entry const * symb, size_t lo, size_t hi);
+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module);
+
+private:
+ /// container we work from
+ callgraph_container const * callgraph;
+
+ void output_symbol_core(std::ostream & out,
+ symbol_entry const * symb, size_t lo, size_t hi);
+ symbol_entry const * symb, size_t lo, size_t hi,
+ bool is_module);
+};
} // namespace format_output
Index: oprofile/libpp/symbol.h
===================================================================
--- oprofile.orig/libpp/symbol.h
+++ oprofile/libpp/symbol.h
--- oprofile.orig/libpp/symbol.h 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libpp/symbol.h 2007-02-22 18:19:12.000000000 +0000
@@ -55,8 +55,11 @@ struct sample_entry {
@@ -562,10 +586,10 @@ Index: oprofile/libpp/symbol.h
+/// a collection of sorted callgraph symbols (the objects themselves)
+typedef std::vector<cg_symbol> cg_collection_objs;
+
-/// a collection of sorted callgraph symbols
-typedef std::vector<cg_symbol> cg_collection;
+
+/// a collection of sorted callgraph symbols (pointers too, compatible with symbol_collection)
+//typedef std::vector<cg_symbol const *> cg_collection;
@@ -573,8 +597,8 @@ Index: oprofile/libpp/symbol.h
/// for storing diff %ages
Index: oprofile/libpp/symbol_sort.cpp
===================================================================
--- oprofile.orig/libpp/symbol_sort.cpp
+++ oprofile/libpp/symbol_sort.cpp
--- oprofile.orig/libpp/symbol_sort.cpp 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libpp/symbol_sort.cpp 2007-02-22 18:19:12.000000000 +0000
@@ -146,23 +146,6 @@ sort(symbol_collection & syms, bool reve
@@ -601,8 +625,8 @@ Index: oprofile/libpp/symbol_sort.cpp
long_filenames = lf;
Index: oprofile/libpp/symbol_sort.h
===================================================================
--- oprofile.orig/libpp/symbol_sort.h
+++ oprofile/libpp/symbol_sort.h
--- oprofile.orig/libpp/symbol_sort.h 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libpp/symbol_sort.h 2007-02-22 18:19:12.000000000 +0000
@@ -44,12 +44,6 @@ struct sort_options {
/**
* Sort the given container by the given criteria.
@@ -618,9 +642,9 @@ Index: oprofile/libpp/symbol_sort.h
Index: oprofile/libpp/xml_utils.cpp
===================================================================
--- oprofile.orig/libpp/xml_utils.cpp
+++ oprofile/libpp/xml_utils.cpp
@@ -257,13 +257,6 @@ void xml_utils::output_xml_header(string
--- oprofile.orig/libpp/xml_utils.cpp 2007-02-22 18:19:12.000000000 +0000
+++ oprofile/libpp/xml_utils.cpp 2007-02-22 18:24:58.000000000 +0000
@@ -268,13 +268,6 @@ void xml_utils::output_xml_header(string
cout << close_element(SETUP) << endl;
}
@@ -634,19 +658,53 @@ Index: oprofile/libpp/xml_utils.cpp
class subclass_info_t {
public:
string unitmask;
@@ -589,7 +582,7 @@ void module_info::output_summary(ostream
void module_info::output_symbols(ostream & out)
{
for (sym_iterator it = begin; it != end; ++it)
- xml_out->output_symbol(out, it, lo, hi);
+ xml_out->output_symbol(out, *it, lo, hi);
@@ -443,7 +436,7 @@ public:
bool is_closed(string const & n);
protected:
void output_summary(ostream & out);
- void output_symbols(ostream & out);
+ void output_symbols(ostream & out, bool is_module);
string name;
sym_iterator begin;
@@ -593,7 +586,7 @@ void module_info::output(ostream & out)
out << open_element(MODULE, true);
out << init_attr(NAME, name) << close_element(NONE, true);
output_summary(out);
- output_symbols(out);
+ output_symbols(out, true);
out << close_element(MODULE);
}
@@ -605,13 +598,13 @@ void module_info::output_summary(ostream
}
-void module_info::output_symbols(ostream & out)
+void module_info::output_symbols(ostream & out, bool is_module)
{
if (begin == (sym_iterator)0)
return;
for (sym_iterator it = begin; it != end; ++it)
- xml_out->output_symbol(out, it, lo, hi);
+ xml_out->output_symbol(out, *it, lo, hi, is_module);
}
@@ -791,7 +784,7 @@ void binary_info::output(ostream & out)
out << init_attr(NAME, name) << close_element(NONE, true);
output_summary(out);
- output_symbols(out);
+ output_symbols(out, false);
for (size_t a = 0; a < nr_modules; ++a)
my_modules[a].output(out);
Index: oprofile/libutil++/xml_output.cpp
===================================================================
--- oprofile.orig/libutil++/xml_output.cpp
+++ oprofile/libutil++/xml_output.cpp
--- oprofile.orig/libutil++/xml_output.cpp 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libutil++/xml_output.cpp 2007-02-22 18:19:12.000000000 +0000
@@ -47,8 +47,11 @@ string const xml_tag_map[] = {
"binary",
"module",
@@ -661,8 +719,8 @@ Index: oprofile/libutil++/xml_output.cpp
"symboltable",
Index: oprofile/libutil++/xml_output.h
===================================================================
--- oprofile.orig/libutil++/xml_output.h
+++ oprofile/libutil++/xml_output.h
--- oprofile.orig/libutil++/xml_output.h 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/libutil++/xml_output.h 2007-02-22 18:19:12.000000000 +0000
@@ -28,7 +28,8 @@ typedef enum {
THREAD, THREAD_ID,
BINARY,
@@ -675,8 +733,8 @@ Index: oprofile/libutil++/xml_output.h
SOURCE_FILE, SOURCE_LINE, CODE_LENGTH,
Index: oprofile/pp/opreport.cpp
===================================================================
--- oprofile.orig/pp/opreport.cpp
+++ oprofile/pp/opreport.cpp
--- oprofile.orig/pp/opreport.cpp 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/pp/opreport.cpp 2007-02-22 18:19:12.000000000 +0000
@@ -378,7 +378,7 @@ void output_symbols(profile_container co
format_output::opreport_formatter * text_out = 0;
@@ -743,8 +801,8 @@ Index: oprofile/pp/opreport.cpp
Index: oprofile/pp/opreport_options.cpp
===================================================================
--- oprofile.orig/pp/opreport_options.cpp
+++ oprofile/pp/opreport_options.cpp
--- oprofile.orig/pp/opreport_options.cpp 2007-02-22 18:19:11.000000000 +0000
+++ oprofile/pp/opreport_options.cpp 2007-02-22 18:19:12.000000000 +0000
@@ -177,11 +177,6 @@ void check_options(bool diff)
}
+1 -1
View File
@@ -1,5 +1,5 @@
PV = "0.9.2+cvs${SRCDATE}"
PR = "r2"
PR = "r3"
SECTION = "devel"
DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \
of profiling all running code at low overhead."