From 8e2698e0cb99f34abcc3def5c5479da29aacd89b Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 23 May 2007 13:33:49 +0000 Subject: 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 --- meta/packages/oprofile/oprofile/armv6_events.patch | 118 +++++ .../packages/oprofile/oprofile/cg_collection.patch | 289 ----------- .../packages/oprofile/oprofile/oprofile_eabi.patch | 30 -- .../packages/oprofile/oprofile/xml_callgraph.patch | 542 --------------------- .../packages/oprofile/oprofile/xscale_events.patch | 39 ++ meta/packages/oprofile/oprofile_cvs.bb | 8 +- 6 files changed, 160 insertions(+), 866 deletions(-) create mode 100644 meta/packages/oprofile/oprofile/armv6_events.patch delete mode 100644 meta/packages/oprofile/oprofile/cg_collection.patch delete mode 100644 meta/packages/oprofile/oprofile/oprofile_eabi.patch delete mode 100644 meta/packages/oprofile/oprofile/xml_callgraph.patch create mode 100644 meta/packages/oprofile/oprofile/xscale_events.patch (limited to 'meta') diff --git a/meta/packages/oprofile/oprofile/armv6_events.patch b/meta/packages/oprofile/oprofile/armv6_events.patch new file mode 100644 index 000000000..fc9a56b8a --- /dev/null +++ b/meta/packages/oprofile/oprofile/armv6_events.patch @@ -0,0 +1,118 @@ +--- + events/Makefile.am | 1 + + events/arm/armv6/events | 25 +++++++++++++++++++++++++ + events/arm/armv6/unit_masks | 4 ++++ + libop/op_cpu_type.c | 1 + + libop/op_cpu_type.h | 1 + + libop/op_events.c | 1 + + utils/ophelp.c | 5 ++++- + 7 files changed, 37 insertions(+), 1 deletion(-) + +Index: oprofile/events/Makefile.am +=================================================================== +--- oprofile.orig/events/Makefile.am 2007-05-23 11:32:24.000000000 +0100 ++++ oprofile/events/Makefile.am 2007-05-23 14:13:12.000000000 +0100 +@@ -29,6 +29,7 @@ event_files = \ + x86-64/family10/events x86-64/family10/unit_masks \ + arm/xscale1/events arm/xscale1/unit_masks \ + arm/xscale2/events arm/xscale2/unit_masks \ ++ arm/armv6/events arm/armv6/unit_masks \ + mips/20K/events mips/20K/unit_masks \ + mips/24K/events mips/24K/unit_masks \ + mips/25K/events mips/25K/unit_masks \ +Index: oprofile/events/arm/armv6/events +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/events/arm/armv6/events 2007-05-23 14:13:12.000000000 +0100 +@@ -0,0 +1,25 @@ ++# ARM V6 events ++# ++event:0x00 counters:1,2 um:zero minimum:500 name:IFU_IFETCH_MISS : number of instruction fetch misses ++event:0x01 counters:1,2 um:zero minimum:500 name:CYCLES_IFU_MEM_STALL : cycles instruction fetch pipe is stalled ++event:0x02 counters:1,2 um:zero minimum:500 name:CYCLES_DATA_STALL : cycles stall occurs for due to data dependency ++event:0x03 counters:1,2 um:zero minimum:500 name:ITLB_MISS : number of ITLB misses ++event:0x04 counters:1,2 um:zero minimum:500 name:DTLB_MISS : number of DTLB misses ++event:0x05 counters:1,2 um:zero minimum:500 name:BR_INST_EXECUTED : branch instruction executed w/ or w/o program flow change ++event:0x06 counters:1,2 um:zero minimum:500 name:BR_INST_MISS_PRED : branch mispredicted ++event:0x07 counters:1,2 um:zero minimum:500 name:INSN_EXECUTED : instruction executed ++event:0x08 counters:1,2 um:zero minimum:500 name:CYCLES_DCACHE_FULL_STALL : cycles in stall due to full dcache ++event:0x09 counters:1,1 um:zero minimum:500 name:DCACHE_FULL_STALL_CNT : number of stalls due to dcache full condition ++event:0x0a counters:1,2 um:zero minimum:500 name:DCACHE_ACCESS : data cache access ++event:0x0b counters:1,2 um:zero minimum:500 name:DCACHE_MISS : data cache miss ++event:0x0c counters:1,2 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline ++event:0x0d counters:1,2 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch ++event:0x0f counters:1,2 um:zero minimum:500 name:TLB_MISS : Main TLB miss ++event:0x10 counters:1,2 um:zero minimum:500 name:EXP_EXTERNAL : Explict external data access ++event:0x11 counters:1,2 um:zero minimum:500 name:LSU_STALL : cycles stalled because Load Store request queque is full ++event:0x12 counters:1,2 um:zero minimum:500 name:WRITE_DRAIN : Time swrite buffer was drained ++event:0x20 counters:1,2 um:zero minimum:500 name:ETMEXTOUT0 : nuber of cycles ETMEXTOUT[0] signal was asserted ++event:0x21 counters:1,2 um:zero minimum:500 name:ETMEXTOUT1 : nuber of cycles ETMEXTOUT[1] signal was asserted ++event:0x22 counters:1,2 um:zero minimum:500 name:ETMEXTOUT_BOTH : nuber of cycles both ETMEXTOUT [0] and [1] were asserted * 2 ++event:0xff counters:1,2 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter ++event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter +Index: oprofile/events/arm/armv6/unit_masks +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ oprofile/events/arm/armv6/unit_masks 2007-05-23 14:13:12.000000000 +0100 +@@ -0,0 +1,4 @@ ++# ARM V6 PMU possible unit masks ++# ++name:zero type:mandatory default:0x00 ++ 0x00 No unit mask +Index: oprofile/libop/op_cpu_type.c +=================================================================== +--- oprofile.orig/libop/op_cpu_type.c 2007-05-23 11:32:35.000000000 +0100 ++++ oprofile/libop/op_cpu_type.c 2007-05-23 14:13:12.000000000 +0100 +@@ -69,6 +69,7 @@ static struct cpu_descr const cpu_descrs + { "ppc64 Cell Broadband Engine", "ppc64/cell-be", CPU_PPC64_CELL, 8 }, + { "AMD64 family10", "x86-64/family10", CPU_FAMILY10, 4 }, + { "ppc64 PA6T", "ppc64/pa6t", CPU_PPC64_PA6T, 6 }, ++ { "ARM/V6 PMU", "arm/armv6", CPU_ARM_V6, 3 }, + }; + + static size_t const nr_cpu_descrs = sizeof(cpu_descrs) / sizeof(struct cpu_descr); +Index: oprofile/libop/op_cpu_type.h +=================================================================== +--- oprofile.orig/libop/op_cpu_type.h 2007-05-23 11:32:35.000000000 +0100 ++++ oprofile/libop/op_cpu_type.h 2007-05-23 14:13:12.000000000 +0100 +@@ -67,6 +67,7 @@ typedef enum { + CPU_PPC64_CELL, /**< ppc64 Cell Broadband Engine*/ + CPU_FAMILY10, /**< AMD family 10 */ + CPU_PPC64_PA6T, /**< ppc64 PA6T */ ++ CPU_ARM_V6, /**< ARM V6 PMU */ + MAX_CPU_TYPE + } op_cpu; + +Index: oprofile/libop/op_events.c +=================================================================== +--- oprofile.orig/libop/op_events.c 2007-05-23 11:32:35.000000000 +0100 ++++ oprofile/libop/op_events.c 2007-05-23 14:13:12.000000000 +0100 +@@ -785,6 +785,7 @@ void op_default_event(op_cpu cpu_type, s + // we could possibly use the CCNT + case CPU_ARM_XSCALE1: + case CPU_ARM_XSCALE2: ++ case CPU_ARM_V6: + descr->name = "CPU_CYCLES"; + break; + +Index: oprofile/utils/ophelp.c +=================================================================== +--- oprofile.orig/utils/ophelp.c 2007-05-23 11:32:45.000000000 +0100 ++++ oprofile/utils/ophelp.c 2007-05-23 14:16:33.000000000 +0100 +@@ -424,12 +424,15 @@ int main(int argc, char const * argv[]) + printf("See Intel XScale Core Developer's Manual\n" + "Chapter 8 Performance Monitoring\n"); + break; ++ ++ case CPU_ARM_V6: ++ printf("See ARM11 Technical Reference Manual\n"); + break; + + case CPU_PPC64_PA6T: + printf("See PA6T Power Implementation Features Book IV\n" + "Chapter 7 Performance Counters\n"); +- break; ++ break; + + case CPU_PPC64_POWER4: + 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 a87ec7247..000000000 --- a/meta/packages/oprofile/oprofile/cg_collection.patch +++ /dev/null @@ -1,289 +0,0 @@ - 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(*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(*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 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_collection; -- -+/// a collection of sorted callgraph symbol objects -+typedef std::vector cg_collection_objs; - - /// for storing diff %ages - typedef growable_vector 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_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 - -+ * 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 -+ - * 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 diff --git a/meta/packages/oprofile/oprofile/oprofile_eabi.patch b/meta/packages/oprofile/oprofile/oprofile_eabi.patch deleted file mode 100644 index 2ae269f86..000000000 --- a/meta/packages/oprofile/oprofile/oprofile_eabi.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- - daemon/opd_cookie.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -Index: oprofile/daemon/opd_cookie.c -=================================================================== ---- oprofile.orig/daemon/opd_cookie.c -+++ oprofile/daemon/opd_cookie.c -@@ -68,7 +68,8 @@ static inline int lookup_dcookie(cookie_ - return syscall(__NR_lookup_dcookie, (unsigned long)(cookie >> 32), - (unsigned long)(cookie & 0xffffffff), buf, size); - } --#elif (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)) /*_MIPSEL */ -+#elif (defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)) \ -+ || (defined(__arm__) && defined(__ARM_EABI__)) - 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 -+ -+ * oprofile/daemon/opd_cookie.c: Fix syscall for ARM EABI -+ - 2007-04-25 Manoj Ekbote - - * 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 f089e7dc4..000000000 --- a/meta/packages/oprofile/oprofile/xml_callgraph.patch +++ /dev/null @@ -1,542 +0,0 @@ - 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/format_output.cpp -=================================================================== ---- oprofile.orig/libpp/format_output.cpp -+++ oprofile/libpp/format_output.cpp -@@ -562,6 +562,20 @@ ostringstream bytes_out; - map symbol_data_table; - size_t symbol_data_index = 0; - -+/* Return any existing index or add to the table */ -+size_t xml_get_symbol_index(string const name) -+{ -+ size_t index = symbol_data_index; -+ map::iterator it = symbol_data_table.find(name); -+ -+ if (it == symbol_data_table.end()) { -+ symbol_data_table[name] = symbol_data_index++; -+ return index; -+ } -+ -+ return it->second; -+} -+ - - class symbol_details_t { - public: -@@ -577,14 +591,15 @@ symbol_details_array_t symbol_details; - size_t detail_table_index = 0; - - xml_formatter:: --xml_formatter(profile_container const & p, -+xml_formatter(profile_container const *p, - symbol_collection & s) - : - profile(p), - symbols(s), - need_details(false) - { -- counts.total = profile.samples_count(); -+ if (profile) -+ counts.total = profile->samples_count(); - } - - -@@ -640,12 +655,11 @@ void xml_formatter::output_symbol_data(o - string const image = get_image_name(symb->image_name, true); - string const qname = image + ":" + name; - map::iterator sd_it = symbol_data_table.find(qname); -- size_t si = xml_support->get_symbol_index(it); - -- if (sd_it->second == si) { -+ if (sd_it != symbol_data_table.end()) { - // first time we've seen this symbol - out << open_element(SYMBOL_DATA, true); -- out << init_attr(TABLE_ID, si); -+ out << init_attr(TABLE_ID, sd_it->second); - - field_datum datum(*symb, symb->sample, 0, counts); - -@@ -660,9 +674,12 @@ void xml_formatter::output_symbol_data(o - output_attribute(out, datum, ff_vma, STARTING_ADDR); - - if (need_details) -- xml_support->output_symbol_bytes(bytes_out, symb, si); -+ xml_support->output_symbol_bytes(bytes_out, symb, sd_it->second); - } - out << close_element(); -+ -+ // seen so remove (otherwise get several "no symbols") -+ symbol_data_table.erase(qname); - } - } - out << close_element(SYMBOL_TABLE); -@@ -675,8 +692,8 @@ output_symbol_details(symbol_entry const - if (!has_sample_counts(symb->sample.counts, lo, hi)) - return ""; - -- sample_container::samples_iterator it = profile.begin(symb); -- sample_container::samples_iterator end = profile.end(symb); -+ sample_container::samples_iterator it = profile->begin(symb); -+ sample_container::samples_iterator end = profile->end(symb); - - ostringstream str; - for (; it != end; ++it) { -@@ -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, bool is_module) - { -- symbol_entry const * symb = *it; - ostringstream str; -+ // 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; -@@ -752,27 +770,21 @@ output_symbol(ostream & out, - - string const image = get_image_name(symb->image_name, true); - string const qname = image + ":" + name; -- map::iterator sd_it = symbol_data_table.find(qname); -- size_t si = xml_support->get_symbol_index(it); - -- // if this is the first time we've seen this symbol, save it's index -- if (sd_it == symbol_data_table.end()) -- symbol_data_table[qname] = si; -- else -- si = sd_it->second; -+ indx = xml_get_symbol_index(qname); - -- out << init_attr(ID_REF, si); -+ out << init_attr(ID_REF, indx); - - if (need_details) { - ostringstream details; -- symbol_details_t & sd = symbol_details[si]; -+ symbol_details_t & sd = symbol_details[indx]; - size_t const detail_lo = sd.index; - - string detail_str = output_symbol_details(symb, sd.index, lo, hi); - - if (detail_str.size() > 0) { - if (sd.id < 0) -- sd.id = si; -+ sd.id = indx; - details << detail_str; - } - -@@ -828,5 +840,131 @@ output_attribute(ostream & out, field_da - } - } - -+xml_cg_formatter:: -+xml_cg_formatter(callgraph_container const * cg, symbol_collection & s) -+ : -+ xml_formatter(NULL, s), -+ callgraph(cg) -+{ -+ counts.total = callgraph->samples_count(); -+} -+ -+void xml_cg_formatter::output(ostream & out) -+{ -+ xml_support->build_subclasses(out); -+ -+ xml_support->output_program_structure(out); -+ output_symbol_data(out); -+ -+ out << close_element(PROFILE); -+} -+ -+void xml_cg_formatter:: -+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) -+{ -+ -+ cg_symbol::children::const_iterator cit; -+ cg_symbol::children::const_iterator cend = cg_symb.end(); -+ -+ for (cit = cg_symb.begin(); cit != cend; ++cit) { -+ string binary = get_image_name((cit)->app_name, true); -+ string module = get_image_name((cit)->image_name, true); -+ bool got_samples = false, self = false; -+ ostringstream str; -+ size_t indx; -+ -+ for (size_t p = lo; p <= hi; ++p) -+ got_samples |= xml_support->output_summary_data(str, cit->sample.counts, p); -+ -+ if (!got_samples) -+ continue; -+ -+ cverb << vxml << " " << 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 symname = symbol_names.name(cit->name); -+ assert(symname.size() > 0); -+ -+ string const symqname = module + ":" + symname; -+ -+ // Find any self references and handle -+ if ((symname == selfname) && (tag == CALLEES)) { -+ self = true; -+ indx = xml_get_symbol_index(qname); -+ } else -+ indx = xml_get_symbol_index(symqname); -+ -+ out << init_attr(ID_REF, indx); -+ -+ if (self) -+ out << init_attr(SELFREF, "true"); -+ -+ out << close_element(NONE, true); -+ out << str.str(); -+ out << close_element(SYMBOL); -+ -+ if (is_module) -+ out << close_element(MODULE); -+ } -+} -+ -+ -+void xml_cg_formatter:: -+output_symbol(ostream & out, -+ symbol_entry const * symb, size_t lo, size_t hi, bool is_module) -+{ -+ cg_symbol const * cg_symb = dynamic_cast(symb); -+ ostringstream str; -+ -+ // output symbol's summary data for each profile class -+ bool got_samples = false; -+ -+ for (size_t p = lo; p <= hi; ++p) { -+ got_samples |= xml_support->output_summary_data(str, -+ symb->sample.counts, p); -+ } -+ -+ if (!got_samples) -+ return; -+ -+ cverb << vxml << " " << endl; -+ -+ out << open_element(SYMBOL, true); -+ -+ 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; -+ -+ string const selfname = symbol_names.demangle(symb->name) + " [self]"; -+ -+ out << init_attr(ID_REF, xml_get_symbol_index(qname)); -+ -+ out << close_element(NONE, true); -+ -+ out << open_element(CALLERS); -+ if (cg_symb) -+ output_symbol_core(out, cg_symb->callers, selfname, qname, lo, hi, is_module, CALLERS); -+ out << close_element(CALLERS); -+ -+ out << open_element(CALLEES); -+ if (cg_symb) -+ output_symbol_core(out, cg_symb->callees, selfname, qname, lo, hi, is_module, CALLEES); -+ -+ out << close_element(CALLEES); -+ -+ // output summary -+ out << str.str(); -+ out << close_element(SYMBOL); -+} - - } // namespace format_output -Index: oprofile/libpp/format_output.h -=================================================================== ---- oprofile.orig/libpp/format_output.h -+++ oprofile/libpp/format_output.h -@@ -227,7 +227,7 @@ private: - class xml_formatter : public formatter { - public: - /// build a ready to use formatter -- xml_formatter(profile_container const & profile, -+ xml_formatter(profile_container const * profile, - symbol_collection & symbols); - - // output body of XML output -@@ -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() */ -- void output_symbol(std::ostream & out, -- 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, -+ bool is_module); - - /// output details for the symbol - std::string output_symbol_details(symbol_entry const * symb, -@@ -246,9 +246,12 @@ public: - /// set the output_details boolean - void show_details(bool); - -+ // output SymbolData XML elements -+ void output_symbol_data(std::ostream & out); -+ - private: - /// container we work from -- profile_container const & profile; -+ profile_container const * profile; - - // ordered collection of symbols associated with this profile - symbol_collection & symbols; -@@ -256,9 +259,6 @@ private: - /// true if we need to show details for each symbols - bool need_details; - -- // output SymbolData XML elements -- void output_symbol_data(std::ostream & out); -- - // count of DetailData items output so far - size_t detail_count; - -@@ -270,6 +270,30 @@ private: - format_flags fl, tag_t tag); - }; - -+// callgraph XML output version -+class xml_cg_formatter : public xml_formatter { -+public: -+ /// build a ready to use formatter -+ xml_cg_formatter(callgraph_container const * callgraph, -+ symbol_collection & symbols); -+ -+ // output body of XML output -+ void output(std::ostream & out); -+ -+ /** 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, bool is_module); -+ -+private: -+ /// container we work from -+ callgraph_container const * callgraph; -+ -+ 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/xml_utils.cpp -=================================================================== ---- oprofile.orig/libpp/xml_utils.cpp -+++ oprofile/libpp/xml_utils.cpp -@@ -268,13 +268,6 @@ void xml_utils::output_xml_header(string - cout << close_element(SETUP) << endl; - } - --size_t xml_utils::get_symbol_index(sym_iterator const it) --{ -- return it - symbols_begin; --} -- -- -- - class subclass_info_t { - public: - string unitmask; -@@ -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 -@@ -47,8 +47,11 @@ string const xml_tag_map[] = { - "binary", - "module", - "name", -+ "callers", -+ "callees", - "symbol", - "idref", -+ "self", - "detaillo", - "detailhi", - "symboltable", -Index: oprofile/libutil++/xml_output.h -=================================================================== ---- oprofile.orig/libutil++/xml_output.h -+++ oprofile/libutil++/xml_output.h -@@ -28,7 +28,8 @@ typedef enum { - THREAD, THREAD_ID, - BINARY, - MODULE, NAME, -- SYMBOL, ID_REF, DETAIL_LO, DETAIL_HI, -+ CALLERS, CALLEES, -+ SYMBOL, ID_REF, SELFREF, DETAIL_LO, DETAIL_HI, - SYMBOL_TABLE, - SYMBOL_DATA, STARTING_ADDR, - SOURCE_FILE, SOURCE_LINE, CODE_LENGTH, -Index: oprofile/pp/opreport.cpp -=================================================================== ---- oprofile.orig/pp/opreport.cpp -+++ oprofile/pp/opreport.cpp -@@ -378,7 +378,7 @@ void output_symbols(profile_container co - format_output::opreport_formatter * text_out = 0; - - if (options::xml) { -- xml_out = new format_output::xml_formatter(pc, symbols); -+ xml_out = new format_output::xml_formatter(&pc, symbols); - xml_out->show_details(options::details); - out = xml_out; - // for XML always output long filenames -@@ -450,21 +450,40 @@ void output_cg_symbols(callgraph_contain - options::sort_by.sort(symbols, options::reverse_sort, - options::long_filenames); - -- format_output::cg_formatter out(cg); -+ format_output::formatter * out; -+ format_output::xml_cg_formatter * xml_out = 0; -+ format_output::cg_formatter * text_out = 0; - -- out.set_nr_classes(nr_classes); -- out.show_long_filenames(options::long_filenames); -- out.show_header(options::show_header); -- out.vma_format_64bit(output_hints & cf_64bit_vma); -- out.show_global_percent(options::global_percent); -+ if (options::xml) { -+ xml_out = new format_output::xml_cg_formatter(&cg, symbols); -+ out = xml_out; -+ // for XML always output long filenames -+ out->show_long_filenames(true); -+ } else { -+ text_out = new format_output::cg_formatter(cg); -+ out = text_out; -+ out->show_long_filenames(options::long_filenames); -+ } -+ -+ out->set_nr_classes(nr_classes); -+ out->show_header(options::show_header); -+ out->vma_format_64bit(output_hints & cf_64bit_vma); -+ out->show_global_percent(options::global_percent); - - format_flags flags = get_format_flags(output_hints); - if (multiple_apps) - flags = format_flags(flags | ff_app_name); - -- out.add_format(flags); -+ out->add_format(flags); -+ -+ if (options::xml) { -+ xml_support = new xml_utils(xml_out, symbols, nr_classes, -+ &options::symbol_filter, options::archive_path); -+ xml_out->output(cout); -+ } else { -+ text_out->output(cout, symbols); -+ } - -- out.output(cout, symbols); - } - - -Index: oprofile/pp/opreport_options.cpp -=================================================================== ---- oprofile.orig/pp/opreport_options.cpp -+++ oprofile/pp/opreport_options.cpp -@@ -177,11 +177,6 @@ void check_options(bool diff) - } - - if (xml) { -- if (callgraph) { -- cerr << "--callgraph is incompatible with --xml" << endl; -- do_exit = true; -- } -- - 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 - -+ * 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 -+ - * libpp/callgraph_container.cpp: - * libpp/callgraph_container.h: - * 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 000000000..7f5d1f2bd --- /dev/null +++ b/meta/packages/oprofile/oprofile/xscale_events.patch @@ -0,0 +1,39 @@ +--- + events/arm/xscale1/events | 8 ++++++-- + events/arm/xscale2/events | 8 ++++++-- + 2 files changed, 12 insertions(+), 4 deletions(-) + +Index: oprofile/events/arm/xscale1/events +=================================================================== +--- oprofile.orig/events/arm/xscale1/events 2004-04-06 05:32:22.000000000 +0100 ++++ oprofile/events/arm/xscale1/events 2007-05-23 13:37:04.000000000 +0100 +@@ -14,6 +14,10 @@ event:0x0a counters:1,2 um:zero minimum: + event:0x0b counters:1,2 um:zero minimum:500 name:DCACHE_MISS : data cache miss + event:0x0c counters:1,2 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline + event:0x0d counters:1,2 um:zero minimum:500 name:PC_CHANGE : number of times the program counter was changed without a mode switch ++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 ++event:0x11 counters:1,2 um:zero minimum:500 name:BCU_FULL : number of cycles the BCUs request queue is full ++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 ++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 ++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 ++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 + event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter +-#0x10 through 0x17 Defined by ASSP. See the Intel® XScale" core implementation option section of the ASSP +-#architecture specification for more details. +Index: oprofile/events/arm/xscale2/events +=================================================================== +--- oprofile.orig/events/arm/xscale2/events 2004-04-06 05:32:23.000000000 +0100 ++++ oprofile/events/arm/xscale2/events 2007-05-23 13:37:34.000000000 +0100 +@@ -14,6 +14,10 @@ event:0x0a counters:1,2,3,4 um:zero mini + event:0x0b counters:1,2,3,4 um:zero minimum:500 name:DCACHE_MISS : data cache miss + event:0x0c counters:1,2,3,4 um:zero minimum:500 name:DCACHE_WB : data cache writeback, 1 event for every half cacheline + 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 ++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 ++event:0x11 counters:1,2,3,4 um:zero minimum:500 name:BCU_FULL : number of cycles the BCUs request queue is full ++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 ++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 ++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 ++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 + event:0xfe counters:0 um:zero minimum:500 name:CPU_CYCLES : clock cycles counter +-#0x10 through 0x17 Defined by ASSP. See the Intel® XScale" core implementation option section of the ASSP +-#architecture specification for more details. diff --git a/meta/packages/oprofile/oprofile_cvs.bb b/meta/packages/oprofile/oprofile_cvs.bb index dab1f093a..55bfa97fd 100644 --- a/meta/packages/oprofile/oprofile_cvs.bb +++ b/meta/packages/oprofile/oprofile_cvs.bb @@ -1,5 +1,5 @@ PV = "0.9.2+cvs${SRCDATE}" -PR = "r4" +PR = "r5" SECTION = "devel" DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \ of profiling all running code at low overhead." @@ -7,11 +7,9 @@ LICENSE = "GPL" DEPENDS = "popt binutils" SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=oprofile \ - 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://armv6_events.patch;patch=1 \ + file://xscale_events.patch;patch=1 \ file://acinclude.m4" S = "${WORKDIR}/oprofile" -- cgit v1.2.3