oprofile: Update patches

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1637 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie 2007-05-09 16:11:18 +00:00
parent c91e54338f
commit 1d87eb3ff2
6 changed files with 445 additions and 268 deletions

View File

@ -0,0 +1,289 @@
ChangeLog | 12 ++++++++++++
libpp/callgraph_container.cpp | 21 +++++++++++++--------
libpp/callgraph_container.h | 7 ++++---
libpp/format_output.cpp | 22 +++++++++++-----------
libpp/format_output.h | 2 +-
libpp/symbol.h | 14 ++++++++------
libpp/symbol_sort.cpp | 17 -----------------
libpp/symbol_sort.h | 6 ------
pp/opreport.cpp | 3 ++-
9 files changed, 51 insertions(+), 53 deletions(-)
Index: oprofile/libpp/callgraph_container.cpp
===================================================================
--- oprofile.orig/libpp/callgraph_container.cpp
+++ oprofile/libpp/callgraph_container.cpp
@@ -379,12 +379,15 @@ process(count_array_t total, double thre
process_children(sym, threshold);
- cg_syms.push_back(sym);
+ cg_syms_objs.push_back(sym);
}
+
+ for (unsigned int i = 0; i < cg_syms_objs.size(); i++)
+ cg_syms.push_back(&cg_syms_objs[i]);
}
-cg_collection arc_recorder::get_symbols() const
+symbol_collection arc_recorder::get_symbols() const
{
return cg_syms;
}
@@ -580,12 +583,14 @@ column_flags callgraph_container::output
column_flags output_hints = cf_none;
// FIXME: costly: must we access directly recorder map ?
- cg_collection syms = recorder.get_symbols();
+ symbol_collection syms = recorder.get_symbols();
- cg_collection::const_iterator it;
- cg_collection::const_iterator const end = syms.end();
- for (it = syms.begin(); it != end; ++it)
- output_hints = it->output_hint(output_hints);
+ symbol_collection::iterator it;
+ symbol_collection::iterator const end = syms.end();
+ for (it = syms.begin(); it != end; ++it) {
+ cg_symbol const *cg_symb = dynamic_cast<const cg_symbol *>(*it);
+ output_hints = cg_symb->output_hint(output_hints);
+ }
return output_hints;
}
@@ -597,7 +602,7 @@ count_array_t callgraph_container::sampl
}
-cg_collection callgraph_container::get_symbols() const
+symbol_collection callgraph_container::get_symbols() const
{
return recorder.get_symbols();
}
Index: oprofile/libpp/callgraph_container.h
===================================================================
--- oprofile.orig/libpp/callgraph_container.h
+++ oprofile/libpp/callgraph_container.h
@@ -53,7 +53,7 @@ public:
count_array_t const & arc_count);
/// return all the cg symbols
- cg_collection get_symbols() const;
+ symbol_collection get_symbols() const;
/**
* After population, build the final output, and do
@@ -91,7 +91,8 @@ private:
map_t sym_map;
/// final output data
- cg_collection cg_syms;
+ symbol_collection cg_syms;
+ cg_collection_objs cg_syms_objs;
};
@@ -126,7 +127,7 @@ public:
count_array_t samples_count() const;
// return all the cg symbols
- cg_collection get_symbols() const;
+ symbol_collection get_symbols() const;
private:
/**
Index: oprofile/libpp/format_output.cpp
===================================================================
--- oprofile.orig/libpp/format_output.cpp
+++ oprofile/libpp/format_output.cpp
@@ -489,7 +489,7 @@ cg_formatter::cg_formatter(callgraph_con
}
-void cg_formatter::output(ostream & out, cg_collection const & syms)
+void cg_formatter::output(ostream & out, symbol_collection const & syms)
{
// amount of spacing prefixing child and parent lines
string const child_parent_prefix(" ");
@@ -498,37 +498,37 @@ void cg_formatter::output(ostream & out,
out << string(79, '-') << endl;
- cg_collection::const_iterator it;
- cg_collection::const_iterator end = syms.end();
+ symbol_collection::const_iterator it;
+ symbol_collection::const_iterator end = syms.end();
for (it = syms.begin(); it < end; ++it) {
- cg_symbol const & sym = *it;
+ cg_symbol const *sym = dynamic_cast<const cg_symbol *>(*it);
cg_symbol::children::const_iterator cit;
- cg_symbol::children::const_iterator cend = sym.callers.end();
+ cg_symbol::children::const_iterator cend = sym->callers.end();
counts_t c;
if (global_percent)
c.total = counts.total;
else
- c.total = sym.total_caller_count;
+ c.total = sym->total_caller_count;
- for (cit = sym.callers.begin(); cit != cend; ++cit) {
+ for (cit = sym->callers.begin(); cit != cend; ++cit) {
out << child_parent_prefix;
do_output(out, *cit, cit->sample, c);
}
- do_output(out, sym, sym.sample, counts);
+ do_output(out, *sym, sym->sample, counts);
c = counts_t();
if (global_percent)
c.total = counts.total;
else
- c.total = sym.total_callee_count;
+ c.total = sym->total_callee_count;
- cend = sym.callees.end();
+ cend = sym->callees.end();
- for (cit = sym.callees.begin(); cit != cend; ++cit) {
+ for (cit = sym->callees.begin(); cit != cend; ++cit) {
out << child_parent_prefix;
do_output(out, *cit, cit->sample, c);
}
Index: oprofile/libpp/symbol.h
===================================================================
--- oprofile.orig/libpp/symbol.h
+++ oprofile/libpp/symbol.h
@@ -56,8 +56,11 @@ struct sample_entry {
/// associate a symbol with a file location, samples count and vma address
-struct symbol_entry {
+class symbol_entry {
+public:
symbol_entry() : size(0) {}
+ virtual ~symbol_entry() {}
+
/// which image this symbol belongs to
image_name_id image_name;
/// owning application name: identical to image name if profiling
@@ -93,7 +96,8 @@ typedef std::vector<symbol_entry const *
* the sample counts replaced with the relevant arc counts, whilst
* the cg_symbol retains its self count.
*/
-struct cg_symbol : public symbol_entry {
+class cg_symbol : public symbol_entry {
+public:
cg_symbol(symbol_entry const & sym) : symbol_entry(sym) {}
typedef std::vector<symbol_entry> children;
@@ -109,10 +113,8 @@ struct cg_symbol : public symbol_entry {
count_array_t total_callee_count;
};
-
-/// a collection of sorted callgraph symbols
-typedef std::vector<cg_symbol> cg_collection;
-
+/// a collection of sorted callgraph symbol objects
+typedef std::vector<cg_symbol> cg_collection_objs;
/// for storing diff %ages
typedef growable_vector<double> diff_array_t;
Index: oprofile/libpp/symbol_sort.cpp
===================================================================
--- oprofile.orig/libpp/symbol_sort.cpp
+++ oprofile/libpp/symbol_sort.cpp
@@ -146,23 +146,6 @@ sort(symbol_collection & syms, bool reve
void sort_options::
-sort(cg_collection & syms, bool reverse_sort, bool lf) const
-{
- long_filenames = lf;
-
- vector<sort_order> sort_option(options);
- for (sort_order cur = first; cur != last; cur = sort_order(cur + 1)) {
- if (find(sort_option.begin(), sort_option.end(), cur) ==
- sort_option.end())
- sort_option.push_back(cur);
- }
-
- stable_sort(syms.begin(), syms.end(),
- symbol_compare(sort_option, reverse_sort));
-}
-
-
-void sort_options::
sort(diff_collection & syms, bool reverse_sort, bool lf) const
{
long_filenames = lf;
Index: oprofile/libpp/symbol_sort.h
===================================================================
--- oprofile.orig/libpp/symbol_sort.h
+++ oprofile/libpp/symbol_sort.h
@@ -44,12 +44,6 @@ struct sort_options {
/**
* Sort the given container by the given criteria.
*/
- void sort(cg_collection & syms, bool reverse_sort,
- bool long_filenames) const;
-
- /**
- * Sort the given container by the given criteria.
- */
void sort(diff_collection & syms, bool reverse_sort,
bool long_filenames) const;
Index: oprofile/pp/opreport.cpp
===================================================================
--- oprofile.orig/pp/opreport.cpp
+++ oprofile/pp/opreport.cpp
@@ -445,7 +445,8 @@ void output_cg_symbols(callgraph_contain
{
column_flags output_hints = cg.output_hint();
- cg_collection symbols = cg.get_symbols();
+ symbol_collection symbols = cg.get_symbols();
+
options::sort_by.sort(symbols, options::reverse_sort,
options::long_filenames);
Index: oprofile/ChangeLog
===================================================================
--- oprofile.orig/ChangeLog
+++ oprofile/ChangeLog
@@ -1,5 +1,17 @@
2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+ * libpp/callgraph_container.cpp:
+ * libpp/callgraph_container.h:
+ * libpp/format_output.cpp:
+ * libpp/format_output.h:
+ * libpp/symbol.h:
+ * libpp/symbol_sort.cpp:
+ * libpp/symbol_sort.h:
+ * pp/opreport.cpp: Convert cg_collection to symbol_collection and use
+ dynamic casting allowing more code reuse for callgraphs
+
+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+
* oparchive.cpp:
* oparchive_options.cpp:
* oparchive_options.h: Add --list-files option to list all files that
Index: oprofile/libpp/format_output.h
===================================================================
--- oprofile.orig/libpp/format_output.h
+++ oprofile/libpp/format_output.h
@@ -201,7 +201,7 @@ public:
/** output callgraph information according to the previously format
* specifier set by call(s) to add_format() */
- void output(std::ostream & out, cg_collection const & syms);
+ void output(std::ostream & out, symbol_collection const & syms);
};
/// class to output a columned format symbols plus diff values

View File

@ -2,7 +2,21 @@ Index: oprofile/pp/oparchive.cpp
===================================================================
--- oprofile.orig/pp/oparchive.cpp
+++ oprofile/pp/oparchive.cpp
@@ -97,8 +97,17 @@ int oparchive(options::spec const & spec
@@ -84,9 +84,10 @@ int oparchive(options::spec const & spec
exe_archive_file);
/* If there are any debuginfo files, copy them over.
- * Need to copy the debug info file in the same
- * directory as the executable. The /usr/lib/debug
- * search path is not going to work.
+ * Need to copy the debug info file to somewhere we'll
+ * find it - executable location + "/.debug"
+ * to avoid overwriting files with the same name. The
+ * /usr/lib/debug search path is not going to work.
*/
bfd * ibfd = open_bfd(exe_name);
if (ibfd) {
@@ -97,8 +98,15 @@ int oparchive(options::spec const & spec
if (find_separate_debug_file(ibfd, dirname, global,
debug_filename)) {
/* found something copy it over */
@ -10,15 +24,29 @@ Index: oprofile/pp/oparchive.cpp
- dirname + "/" +
+ string dest_debug_dir = options::outdirectory +
+ dirname + "/.debug/";
+ if (mkdir(dest_debug_dir.c_str(),0755) < 0) {
+ if (errno!=EEXIST) {
+ cerr << "Unable to create directory: "
+ << dest_debug_dir << "." << endl;
+ exit (EXIT_FAILURE);
+ }
+ if (create_dir(dest_debug_dir.c_str())) {
+ cerr << "Unable to create directory: "
+ << dest_debug_dir << "." << endl;
+ exit (EXIT_FAILURE);
+ }
+
+ string dest_debug = dest_debug_dir +
op_basename(debug_filename);
copy_one_file(image_ok, debug_filename, dest_debug);
}
Index: oprofile/ChangeLog
===================================================================
--- oprofile.orig/ChangeLog
+++ oprofile/ChangeLog
@@ -1,5 +1,11 @@
2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+ * oprofile/pp/oparchive.cpp: If the debug files have the same name
+ as the original binary, the binary gets overwritten. Add in a .debug
+ directory to avoid this.
+
+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+
* oprofile/daemon/opd_cookie.c: Fix syscall for ARM EABI
2007-04-25 Manoj Ekbote <manoj.ekbote@broadcom.com>

View File

@ -14,6 +14,45 @@ Index: oprofile/pp/oparchive.cpp
if (!copy_file(source, dest) && err == image_ok) {
cerr << "can't copy from " << source << " to " << dest
<< " cause: " << strerror(errno) << endl;
@@ -46,7 +51,7 @@ int oparchive(options::spec const & spec
handle_options(spec);
/* Check to see if directory can be created */
- if (create_path(options::outdirectory.c_str())) {
+ if (!options::list_files && create_path(options::outdirectory.c_str())) {
cerr << "Unable to create directory for "
<< options::outdirectory << "." << endl;
exit (EXIT_FAILURE);
@@ -73,7 +78,8 @@ int oparchive(options::spec const & spec
cverb << vdebug << exe_name << endl;
/* Create directory for executable file. */
- if (create_path(exe_archive_file.c_str())) {
+ if (!options::list_files
+ && create_path(exe_archive_file.c_str())) {
cerr << "Unable to create directory for "
<< exe_archive_file << "." << endl;
exit (EXIT_FAILURE);
@@ -100,7 +106,8 @@ int oparchive(options::spec const & spec
/* found something copy it over */
string dest_debug_dir = options::outdirectory +
dirname + "/.debug/";
- if (create_dir(dest_debug_dir.c_str())) {
+ if (!options::list_files
+ && create_dir(dest_debug_dir.c_str())) {
cerr << "Unable to create directory: "
<< dest_debug_dir << "." << endl;
exit (EXIT_FAILURE);
@@ -130,7 +137,8 @@ int oparchive(options::spec const & spec
cverb << vdebug << (sample_name) << endl;
cverb << vdebug << " destp " << sample_archive_file << endl;
- if (create_path(sample_archive_file.c_str())) {
+ if (!options::list_files
+ && create_path(sample_archive_file.c_str())) {
cerr << "Unable to create directory for "
<< sample_archive_file << "." << endl;
exit (EXIT_FAILURE);
Index: oprofile/pp/oparchive_options.cpp
===================================================================
--- oprofile.orig/pp/oparchive_options.cpp
@ -58,3 +97,35 @@ Index: oprofile/pp/oparchive_options.h
}
/// All the chosen sample files.
Index: oprofile/ChangeLog
===================================================================
--- oprofile.orig/ChangeLog
+++ oprofile/ChangeLog
@@ -1,5 +1,12 @@
2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+ * oparchive.cpp:
+ * oparchive_options.cpp:
+ * oparchive_options.h: Add --list-files option to list all files that
+ would be handled by oparchive.
+
+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+
* oprofile/pp/oparchive.cpp: If the debug files have the same name
as the original binary, the binary gets overwritten. Add in a .debug
directory to avoid this.
Index: oprofile/doc/oparchive.1.in
===================================================================
--- oprofile.orig/doc/oparchive.1.in
+++ oprofile/doc/oparchive.1.in
@@ -50,6 +50,10 @@ Output to the given directory. There is
Do not include application-specific images for libraries, kernel modules
and the kernel. This option only makes sense if the profile session
used --separate.
+.br
+.TP
+.BI "--list-files / -l"
+Only list the files that would be archived, don't copy them.
.SH ENVIRONMENT
No special environment variables are recognised by oparchive.

View File

@ -16,3 +16,15 @@ Index: oprofile/daemon/opd_cookie.c
static inline int lookup_dcookie(cookie_t cookie, char * buf, size_t size)
{
return syscall(__NR_lookup_dcookie,
Index: oprofile/ChangeLog
===================================================================
--- oprofile.orig/ChangeLog
+++ oprofile/ChangeLog
@@ -1,3 +1,7 @@
+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+
+ * oprofile/daemon/opd_cookie.c: Fix syscall for ARM EABI
+
2007-04-25 Manoj Ekbote <manoj.ekbote@broadcom.com>
* events/mips/sb1/events: fix SB1 events

View File

@ -1,162 +1,18 @@
---
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(-)
ChangeLog | 10 ++
libpp/format_output.cpp | 178 +++++++++++++++++++++++++++++++++++++++++------
libpp/format_output.h | 40 ++++++++--
libpp/xml_utils.cpp | 17 +---
libutil++/xml_output.cpp | 3
libutil++/xml_output.h | 3
pp/opreport.cpp | 37 +++++++--
pp/opreport_options.cpp | 5 -
8 files changed, 238 insertions(+), 55 deletions(-)
Index: oprofile/libpp/callgraph_container.cpp
===================================================================
--- oprofile.orig/libpp/callgraph_container.cpp
+++ oprofile/libpp/callgraph_container.cpp
@@ -379,12 +379,15 @@ process(count_array_t total, double thre
process_children(sym, threshold);
- cg_syms.push_back(sym);
+ cg_syms_objs.push_back(sym);
}
+
+ for (unsigned int i = 0; i < cg_syms_objs.size(); i++)
+ cg_syms.push_back(&cg_syms_objs[i]);
}
-cg_collection arc_recorder::get_symbols() const
+symbol_collection arc_recorder::get_symbols() const
{
return cg_syms;
}
@@ -580,12 +583,14 @@ column_flags callgraph_container::output
column_flags output_hints = cf_none;
// FIXME: costly: must we access directly recorder map ?
- cg_collection syms = recorder.get_symbols();
+ symbol_collection syms = recorder.get_symbols();
- cg_collection::const_iterator it;
- cg_collection::const_iterator const end = syms.end();
- for (it = syms.begin(); it != end; ++it)
- output_hints = it->output_hint(output_hints);
+ symbol_collection::iterator it;
+ symbol_collection::iterator const end = syms.end();
+ for (it = syms.begin(); it != end; ++it) {
+ cg_symbol const *cg_symb = dynamic_cast<const cg_symbol *>(*it);
+ output_hints = cg_symb->output_hint(output_hints);
+ }
return output_hints;
}
@@ -597,7 +602,7 @@ count_array_t callgraph_container::sampl
}
-cg_collection callgraph_container::get_symbols() const
+symbol_collection callgraph_container::get_symbols() const
{
return recorder.get_symbols();
}
Index: oprofile/libpp/callgraph_container.h
===================================================================
--- oprofile.orig/libpp/callgraph_container.h
+++ oprofile/libpp/callgraph_container.h
@@ -53,7 +53,7 @@ public:
count_array_t const & arc_count);
/// return all the cg symbols
- cg_collection get_symbols() const;
+ symbol_collection get_symbols() const;
/**
* After population, build the final output, and do
@@ -91,7 +91,8 @@ private:
map_t sym_map;
/// final output data
- cg_collection cg_syms;
+ symbol_collection cg_syms;
+ cg_collection_objs cg_syms_objs;
};
@@ -126,7 +127,7 @@ public:
count_array_t samples_count() const;
// return all the cg symbols
- cg_collection get_symbols() const;
+ symbol_collection get_symbols() const;
private:
/**
Index: oprofile/libpp/format_output.cpp
===================================================================
--- oprofile.orig/libpp/format_output.cpp
+++ oprofile/libpp/format_output.cpp
@@ -489,7 +489,7 @@ cg_formatter::cg_formatter(callgraph_con
}
-void cg_formatter::output(ostream & out, cg_collection const & syms)
+void cg_formatter::output(ostream & out, symbol_collection const & syms)
{
// amount of spacing prefixing child and parent lines
string const child_parent_prefix(" ");
@@ -498,37 +498,37 @@ void cg_formatter::output(ostream & out,
out << string(79, '-') << endl;
- cg_collection::const_iterator it;
- cg_collection::const_iterator end = syms.end();
+ symbol_collection::const_iterator it;
+ symbol_collection::const_iterator end = syms.end();
for (it = syms.begin(); it < end; ++it) {
- cg_symbol const & sym = *it;
+ cg_symbol const *sym = dynamic_cast<const cg_symbol *>(*it);
cg_symbol::children::const_iterator cit;
- cg_symbol::children::const_iterator cend = sym.callers.end();
+ cg_symbol::children::const_iterator cend = sym->callers.end();
counts_t c;
if (global_percent)
c.total = counts.total;
else
- c.total = sym.total_caller_count;
+ c.total = sym->total_caller_count;
- for (cit = sym.callers.begin(); cit != cend; ++cit) {
+ for (cit = sym->callers.begin(); cit != cend; ++cit) {
out << child_parent_prefix;
do_output(out, *cit, cit->sample, c);
}
- do_output(out, sym, sym.sample, counts);
+ do_output(out, *sym, sym->sample, counts);
c = counts_t();
if (global_percent)
c.total = counts.total;
else
- c.total = sym.total_callee_count;
+ c.total = sym->total_callee_count;
- cend = sym.callees.end();
+ cend = sym->callees.end();
- for (cit = sym.callees.begin(); cit != cend; ++cit) {
+ for (cit = sym->callees.begin(); cit != cend; ++cit) {
out << child_parent_prefix;
do_output(out, *cit, cit->sample, c);
}
@@ -562,6 +562,20 @@ ostringstream bytes_out;
map<string, size_t> symbol_data_table;
size_t symbol_data_index = 0;
@ -306,7 +162,7 @@ Index: oprofile/libpp/format_output.cpp
+}
+
+void xml_cg_formatter::
+output_symbol_core(ostream & out, cg_symbol::children const cg_symb,
+output_symbol_core(ostream & out, cg_symbol::children const cg_symb,
+ string const selfname, string const qname,
+ size_t lo, size_t hi, bool is_module, tag_t tag)
+{
@ -338,7 +194,7 @@ Index: oprofile/libpp/format_output.cpp
+
+ string const symname = symbol_names.name(cit->name);
+ assert(symname.size() > 0);
+
+
+ string const symqname = module + ":" + symname;
+
+ // Find any self references and handle
@ -387,7 +243,7 @@ Index: oprofile/libpp/format_output.cpp
+
+ string const name = symbol_names.name(symb->name);
+ assert(name.size() > 0);
+
+
+ string const image = get_image_name(symb->image_name, true);
+ string const qname = image + ":" + name;
+
@ -418,15 +274,6 @@ Index: oprofile/libpp/format_output.h
===================================================================
--- oprofile.orig/libpp/format_output.h
+++ oprofile/libpp/format_output.h
@@ -201,7 +201,7 @@ public:
/** output callgraph information according to the previously format
* specifier set by call(s) to add_format() */
- void output(std::ostream & out, cg_collection const & syms);
+ void output(std::ostream & out, symbol_collection const & syms);
};
/// class to output a columned format symbols plus diff values
@@ -227,7 +227,7 @@ private:
class xml_formatter : public formatter {
public:
@ -496,99 +343,14 @@ Index: oprofile/libpp/format_output.h
+ /// container we work from
+ callgraph_container const * callgraph;
+
+ void output_symbol_core(std::ostream & out,
+ cg_symbol::children const cg_symb,
+ void output_symbol_core(std::ostream & out,
+ cg_symbol::children const cg_symb,
+ std::string const selfname, std::string const qname,
+ size_t lo, size_t hi, bool is_module, tag_t tag);
+};
} // namespace format_output
Index: oprofile/libpp/symbol.h
===================================================================
--- oprofile.orig/libpp/symbol.h
+++ oprofile/libpp/symbol.h
@@ -56,8 +56,11 @@ struct sample_entry {
/// associate a symbol with a file location, samples count and vma address
-struct symbol_entry {
+class symbol_entry {
+public:
symbol_entry() : size(0) {}
+ virtual ~symbol_entry() {}
+
/// which image this symbol belongs to
image_name_id image_name;
/// owning application name: identical to image name if profiling
@@ -93,7 +96,8 @@ typedef std::vector<symbol_entry const *
* the sample counts replaced with the relevant arc counts, whilst
* the cg_symbol retains its self count.
*/
-struct cg_symbol : public symbol_entry {
+class cg_symbol : public symbol_entry {
+public:
cg_symbol(symbol_entry const & sym) : symbol_entry(sym) {}
typedef std::vector<symbol_entry> children;
@@ -109,10 +113,8 @@ struct cg_symbol : public symbol_entry {
count_array_t total_callee_count;
};
-
-/// a collection of sorted callgraph symbols
-typedef std::vector<cg_symbol> cg_collection;
-
+/// a collection of sorted callgraph symbol objects
+typedef std::vector<cg_symbol> cg_collection_objs;
/// for storing diff %ages
typedef growable_vector<double> diff_array_t;
Index: oprofile/libpp/symbol_sort.cpp
===================================================================
--- oprofile.orig/libpp/symbol_sort.cpp
+++ oprofile/libpp/symbol_sort.cpp
@@ -146,23 +146,6 @@ sort(symbol_collection & syms, bool reve
void sort_options::
-sort(cg_collection & syms, bool reverse_sort, bool lf) const
-{
- long_filenames = lf;
-
- vector<sort_order> sort_option(options);
- for (sort_order cur = first; cur != last; cur = sort_order(cur + 1)) {
- if (find(sort_option.begin(), sort_option.end(), cur) ==
- sort_option.end())
- sort_option.push_back(cur);
- }
-
- stable_sort(syms.begin(), syms.end(),
- symbol_compare(sort_option, reverse_sort));
-}
-
-
-void sort_options::
sort(diff_collection & syms, bool reverse_sort, bool lf) const
{
long_filenames = lf;
Index: oprofile/libpp/symbol_sort.h
===================================================================
--- oprofile.orig/libpp/symbol_sort.h
+++ oprofile/libpp/symbol_sort.h
@@ -44,12 +44,6 @@ struct sort_options {
/**
* Sort the given container by the given criteria.
*/
- void sort(cg_collection & syms, bool reverse_sort,
- bool long_filenames) const;
-
- /**
- * Sort the given container by the given criteria.
- */
void sort(diff_collection & syms, bool reverse_sort,
bool long_filenames) const;
Index: oprofile/libpp/xml_utils.cpp
===================================================================
--- oprofile.orig/libpp/xml_utils.cpp
@ -693,13 +455,7 @@ Index: oprofile/pp/opreport.cpp
xml_out->show_details(options::details);
out = xml_out;
// for XML always output long filenames
@@ -445,25 +445,45 @@ void output_cg_symbols(callgraph_contain
{
column_flags output_hints = cg.output_hint();
- cg_collection symbols = cg.get_symbols();
+ symbol_collection symbols = cg.get_symbols();
+
@@ -450,21 +450,40 @@ void output_cg_symbols(callgraph_contain
options::sort_by.sort(symbols, options::reverse_sort,
options::long_filenames);
@ -764,3 +520,23 @@ Index: oprofile/pp/opreport_options.cpp
if (accumulated) {
cerr << "--accumulated is incompatible with --xml" << endl;
do_exit = true;
Index: oprofile/ChangeLog
===================================================================
--- oprofile.orig/ChangeLog
+++ oprofile/ChangeLog
@@ -1,5 +1,15 @@
2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+ * libpp/format_output.cpp:
+ * libpp/format_output.h:
+ * libpp/xml_utils.cpp:
+ * libutil++/xml_output.cpp:
+ * libutil++/xml_output.h:
+ * pp/opreport.cpp:
+ * pp/opreport_options.cpp: Add callgraph XML output
+
+2007-05-09 Richard Purdie <rpurdie@openedhand.com>
+
* libpp/callgraph_container.cpp:
* libpp/callgraph_container.h:
* libpp/format_output.cpp:

View File

@ -1,5 +1,5 @@
PV = "0.9.2+cvs${SRCDATE}"
PR = "r3"
PR = "r4"
SECTION = "devel"
DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \
of profiling all running code at low overhead."
@ -10,6 +10,7 @@ SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=
file://oprofile_eabi.patch;patch=1 \
file://oparchive-debug-dir.patch;patch=1 \
file://oparchive-list-files.patch;patch=1 \
file://cg_collection.patch;patch=1 \
file://xml_callgraph.patch;patch=1 \
file://acinclude.m4"
S = "${WORKDIR}/oprofile"