aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/db-export.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2014-10-30 10:09:43 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-11-03 16:06:40 -0500
commitf2bff007679e7d293cb07bb26e18ccf11cc1c4b2 (patch)
tree86ac27cc32eec0977767684006c6d1963e9efe26 /tools/perf/util/db-export.c
parent92a9e4f7db89a013e1bdef2e548928fc71e9867c (diff)
perf tools: Add branch type to db export
Add the ability to export branch types through the database export facility. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1414678188-14946-3-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/db-export.c')
-rw-r--r--tools/perf/util/db-export.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c
index be128b075a32..bccb83120971 100644
--- a/tools/perf/util/db-export.c
+++ b/tools/perf/util/db-export.c
@@ -208,6 +208,15 @@ static int db_ids_from_al(struct db_export *dbe, struct addr_location *al,
208 return 0; 208 return 0;
209} 209}
210 210
211int db_export__branch_type(struct db_export *dbe, u32 branch_type,
212 const char *name)
213{
214 if (dbe->export_branch_type)
215 return dbe->export_branch_type(dbe, branch_type, name);
216
217 return 0;
218}
219
211int db_export__sample(struct db_export *dbe, union perf_event *event, 220int db_export__sample(struct db_export *dbe, union perf_event *event,
212 struct perf_sample *sample, struct perf_evsel *evsel, 221 struct perf_sample *sample, struct perf_evsel *evsel,
213 struct thread *thread, struct addr_location *al) 222 struct thread *thread, struct addr_location *al)
@@ -268,3 +277,42 @@ int db_export__sample(struct db_export *dbe, union perf_event *event,
268 277
269 return 0; 278 return 0;
270} 279}
280
281static struct {
282 u32 branch_type;
283 const char *name;
284} branch_types[] = {
285 {0, "no branch"},
286 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL, "call"},
287 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_RETURN, "return"},
288 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CONDITIONAL, "conditional jump"},
289 {PERF_IP_FLAG_BRANCH, "unconditional jump"},
290 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | PERF_IP_FLAG_INTERRUPT,
291 "software interrupt"},
292 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_RETURN | PERF_IP_FLAG_INTERRUPT,
293 "return from interrupt"},
294 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | PERF_IP_FLAG_SYSCALLRET,
295 "system call"},
296 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_RETURN | PERF_IP_FLAG_SYSCALLRET,
297 "return from system call"},
298 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_ASYNC, "asynchronous branch"},
299 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
300 PERF_IP_FLAG_INTERRUPT, "hardware interrupt"},
301 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_TX_ABORT, "transaction abort"},
302 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_TRACE_BEGIN, "trace begin"},
303 {PERF_IP_FLAG_BRANCH | PERF_IP_FLAG_TRACE_END, "trace end"},
304 {0, NULL}
305};
306
307int db_export__branch_types(struct db_export *dbe)
308{
309 int i, err = 0;
310
311 for (i = 0; branch_types[i].name ; i++) {
312 err = db_export__branch_type(dbe, branch_types[i].branch_type,
313 branch_types[i].name);
314 if (err)
315 break;
316 }
317 return err;
318}