Skip to contentSkip to conversation

perf report: Introduce -u/--unresolved-symbols

PATCH In review Arnaldo Carvalho de Melo 3 participants 3 messages Jul 21, 2009 – Aug 2, 2009 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf report: Introduce -u/--unresolved-symbols

So that we can concentrate on getting more symtabs or on figuring out which files we have to recompile with -g or ask proprietary vendors for graciously ship us rich symtabs.

For instance, shame on me:

[acme@doppio ~]$ perf report -us comm,dso,symbol | head -7 # Samples: 22501
#
# Overhead Command Shared Object Symbol

 # ........  ............  ............................................  ......
 # 
     82.53%  npviewer.bin  /usr/lib64/mozilla/plugins/libflashplayer.so  [.] 0x000000003820d7
      6.34%         skype  /opt/skype_static-2.0.0.72/skype              [.] 0x00000000e1e0b1

;-)

But the next cset should be rather nice, as I realized that doing:

yum install /usr/lib/debug/<DSO NAME WITH MISSING SYMTAB>.debug

Works!

Now think about a world where:

yum install /usr/lib/debug/<DSO NAME WITH MISSING SYMTAB>.symtab

Works, makes the internet a better place by not downloading whales, oops, debuginfo files full of crap we don't need.

Don't get me wrong, the aforementioned crap has its place in this world, just not for the perf tools, _so far_.

Ah, and replace 'yum' with zypper, apt-get (I tried!), smart, urpmi, whatever-is-your-still-non-standardized way to get needed pieces to do real work.

Cc Peter Zijlstra <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>,
---
 tools/perf/Documentation/perf-report.txt |    5 +++++
 tools/perf/builtin-report.c              |   11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-report.txt +5 -0
index e72e931..86aec08 100644
@@ -48,6 +48,11 @@ OPTIONS
 	all occurances of this separator in symbol names (and other output)
 	with a '.' character, that thus it's the only non valid separator.
 
+-u::
+--unresolved-symbols
+
+	Consider only unresolved symbols.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1]
tools/perf/builtin-report.c +9 -2
index a118bc7..c30f4cd 100644
@@ -52,6 +52,7 @@ static int		modules;
 
 static int		full_paths;
 static int		show_nr_samples;
+static int		show_only_unresolved_symbols;
 
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
@@ -1556,8 +1557,12 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name))
 			return 0;
 
-		if (sym_list && sym && !strlist__has_entry(sym_list, sym->name))
-			return 0;
+		if (sym) {
+			if (show_only_unresolved_symbols)
+				return 0;
+			if (sym_list && !strlist__has_entry(sym_list, sym->name))
+				return 0;
+		}
 
 		if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) {
 			eprintf("problem incrementing symbol count, skipping event\n");
@@ -2020,6 +2025,8 @@ static const struct option options[] = {
 	OPT_STRING('t', "field-separator", &field_sep, "separator",
 		   "separator for columns, no spaces will be added between "
 		   "columns '.' is reserved."),
+	OPT_BOOLEAN('u', "unresolved-symbols", &show_only_unresolved_symbols,
+		    "Show only the symbols that were no resolved to names"),
 	OPT_END()
 };
 
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 37 lines · Arnaldo Carvalho de Melo

So that we can concentrate on getting more symtabs or on figuring out which files we have to recompile with -g or ask proprietary vendors for graciously ship us rich symtabs.

For instance, shame on me:

[acme@doppio ~]$ perf report -us comm,dso,symbol | head -7 # Samples: 22501
#
# Overhead Command Shared Object Symbol

 # ........  ............  ............................................  ......
 # 
     82.53%  npviewer.bin  /usr/lib64/mozilla/plugins/libflashplayer.so  [.] 0x000000003820d7
      6.34%         skype  /opt/skype_static-2.0.0.72/skype              [.] 0x00000000e1e0b1

;-)

But the next cset should be rather nice, as I realized that doing:

yum install /usr/lib/debug/<DSO NAME WITH MISSING SYMTAB>.debug

Works!

Now think about a world where:

yum install /usr/lib/debug/<DSO NAME WITH MISSING SYMTAB>.symtab

Works, makes the internet a better place by not downloading whales, oops, debuginfo files full of crap we don't need.

Don't get me wrong, the aforementioned crap has its place in this world, just not for the perf tools, _so far_.

Ah, and replace 'yum' with zypper, apt-get (I tried!), smart, urpmi, whatever-is-your-still-non-standardized way to get needed pieces to do real work.

Quoted 6 lines
Cc Peter Zijlstra <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>,

---

Looks pretty useful :-)

Thanks!
Frederic.

Quoted 59 lines
 tools/perf/Documentation/perf-report.txt |    5 +++++
 tools/perf/builtin-report.c              |   11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-report.txt +5 -0
index e72e931..86aec08 100644
@@ -48,6 +48,11 @@ OPTIONS
 	all occurances of this separator in symbol names (and other output)
 	with a '.' character, that thus it's the only non valid separator.
 
+-u::
+--unresolved-symbols
+
+	Consider only unresolved symbols.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1]
tools/perf/builtin-report.c +9 -2
index a118bc7..c30f4cd 100644
@@ -52,6 +52,7 @@ static int		modules;
 
 static int		full_paths;
 static int		show_nr_samples;
+static int		show_only_unresolved_symbols;
 
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
@@ -1556,8 +1557,12 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name))
 			return 0;
 
-		if (sym_list && sym && !strlist__has_entry(sym_list, sym->name))
-			return 0;
+		if (sym) {
+			if (show_only_unresolved_symbols)
+				return 0;
+			if (sym_list && !strlist__has_entry(sym_list, sym->name))
+				return 0;
+		}
 
 		if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) {
 			eprintf("problem incrementing symbol count, skipping event\n");
@@ -2020,6 +2025,8 @@ static const struct option options[] = {
 	OPT_STRING('t', "field-separator", &field_sep, "separator",
 		   "separator for columns, no spaces will be added between "
 		   "columns '.' is reserved."),
+	OPT_BOOLEAN('u', "unresolved-symbols", &show_only_unresolved_symbols,
+		    "Show only the symbols that were no resolved to names"),
 	OPT_END()
 };
 
Signature · 1 line
1.6.2.5
#2 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 91 lines · Arnaldo Carvalho de Melo

So that we can concentrate on getting more symtabs or on figuring out which files we have to recompile with -g or ask proprietary vendors for graciously ship us rich symtabs.

For instance, shame on me:

[acme@doppio ~]$ perf report -us comm,dso,symbol | head -7 # Samples: 22501
#
# Overhead Command Shared Object Symbol

 # ........  ............  ............................................  ......
 # 
     82.53%  npviewer.bin  /usr/lib64/mozilla/plugins/libflashplayer.so  [.] 0x000000003820d7
      6.34%         skype  /opt/skype_static-2.0.0.72/skype              [.] 0x00000000e1e0b1

;-)

But the next cset should be rather nice, as I realized that doing:

yum install /usr/lib/debug/<DSO NAME WITH MISSING SYMTAB>.debug

Works!

Now think about a world where:

yum install /usr/lib/debug/<DSO NAME WITH MISSING SYMTAB>.symtab

Works, makes the internet a better place by not downloading whales, oops, debuginfo files full of crap we don't need.

Don't get me wrong, the aforementioned crap has its place in this world, just not for the perf tools, _so far_.

Ah, and replace 'yum' with zypper, apt-get (I tried!), smart, urpmi, whatever-is-your-still-non-standardized way to get needed pieces to do real work.

Cc Peter Zijlstra <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>,
---
 tools/perf/Documentation/perf-report.txt |    5 +++++
 tools/perf/builtin-report.c              |   11 +++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-report.txt +5 -0
index e72e931..86aec08 100644
@@ -48,6 +48,11 @@ OPTIONS
 	all occurances of this separator in symbol names (and other output)
 	with a '.' character, that thus it's the only non valid separator.
 
+-u::
+--unresolved-symbols
+
+	Consider only unresolved symbols.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1]
tools/perf/builtin-report.c +7 -2
index a118bc7..c30f4cd 100644
@@ -52,6 +52,7 @@ static int		modules;
 
 static int		full_paths;
 static int		show_nr_samples;
+static int		show_only_unresolved_symbols;
 
 static unsigned long	page_size;
 static unsigned long	mmap_window = 32;
@@ -1556,8 +1557,12 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
 		if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name))
 			return 0;
 
-		if (sym_list && sym && !strlist__has_entry(sym_list, sym->name))
-			return 0;
+		if (sym) {
+			if (show_only_unresolved_symbols)
+				return 0;
+			if (sym_list && !strlist__has_entry(sym_list, sym->name))
+				return 0;
+		}
 
 		if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) {
 			eprintf("problem incrementing symbol count, skipping event\n");

tools/perf/builtin-report.c static const struct option options[] = { · line 2030

Quoted 6 lines
tools/perf/builtin-report.c +2 -0
@@ -2020,6 +2025,8 @@ static const struct option options[] = {
 	OPT_STRING('t', "field-separator", &field_sep, "separator",
 		   "separator for columns, no spaces will be added between "
 		   "columns '.' is reserved."),
+	OPT_BOOLEAN('u', "unresolved-symbols", &show_only_unresolved_symbols,
+		    "Show only the symbols that were no resolved to names"),
 	OPT_END()

Looks nice!

How about also adding an option to initiate the yum install (or apt-get, etc.) debuginfo package installation automatically? It would be a nice 'plug and play' touch.

Ingo