aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2011-05-27 16:28:43 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-06-02 12:28:34 -0400
commit787bef174f055343c69a9639e6e05a564980ed4c (patch)
treed37e4fae03454e74684798bc112ba161786f978a /tools/perf/util/session.c
parent2cee77c4505fc581f41b44e18ffc0953b67a414c (diff)
perf script: "sym" field really means show IP data
Currently the "sym" output field is used to dump instruction pointers and callchain stack. Sample addresses can also be converted to symbols, so the meaning of "sym" needs to be fixed. This patch adds an "ip" option and if it is selected the user can also opt to dump symbols for them. If the user opts to dump IP without syms only the address is shown. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1306528124-25861-2-git-send-email-dsahern@gmail.com Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index f5a8fbdd3f76..ad33650cdd41 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1202,9 +1202,10 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
1202 return NULL; 1202 return NULL;
1203} 1203}
1204 1204
1205void perf_session__print_symbols(union perf_event *event, 1205void perf_session__print_ip(union perf_event *event,
1206 struct perf_sample *sample, 1206 struct perf_sample *sample,
1207 struct perf_session *session) 1207 struct perf_session *session,
1208 int print_sym)
1208{ 1209{
1209 struct addr_location al; 1210 struct addr_location al;
1210 const char *symname, *dsoname; 1211 const char *symname, *dsoname;
@@ -1233,32 +1234,39 @@ void perf_session__print_symbols(union perf_event *event,
1233 if (!node) 1234 if (!node)
1234 break; 1235 break;
1235 1236
1236 if (node->sym && node->sym->name) 1237 printf("\t%16" PRIx64, node->ip);
1237 symname = node->sym->name; 1238 if (print_sym) {
1238 else 1239 if (node->sym && node->sym->name)
1239 symname = ""; 1240 symname = node->sym->name;
1241 else
1242 symname = "";
1240 1243
1241 if (node->map && node->map->dso && node->map->dso->name) 1244 if (node->map && node->map->dso && node->map->dso->name)
1242 dsoname = node->map->dso->name; 1245 dsoname = node->map->dso->name;
1243 else 1246 else
1244 dsoname = ""; 1247 dsoname = "";
1245 1248
1246 printf("\t%16" PRIx64 " %s (%s)\n", node->ip, symname, dsoname); 1249 printf(" %s (%s)", symname, dsoname);
1250 }
1251 printf("\n");
1247 1252
1248 callchain_cursor_advance(cursor); 1253 callchain_cursor_advance(cursor);
1249 } 1254 }
1250 1255
1251 } else { 1256 } else {
1252 if (al.sym && al.sym->name) 1257 printf("%16" PRIx64, al.addr);
1253 symname = al.sym->name; 1258 if (print_sym) {
1254 else 1259 if (al.sym && al.sym->name)
1255 symname = ""; 1260 symname = al.sym->name;
1261 else
1262 symname = "";
1256 1263
1257 if (al.map && al.map->dso && al.map->dso->name) 1264 if (al.map && al.map->dso && al.map->dso->name)
1258 dsoname = al.map->dso->name; 1265 dsoname = al.map->dso->name;
1259 else 1266 else
1260 dsoname = ""; 1267 dsoname = "";
1261 1268
1262 printf("%16" PRIx64 " %s (%s)", al.addr, symname, dsoname); 1269 printf(" %s (%s)", symname, dsoname);
1270 }
1263 } 1271 }
1264} 1272}