aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/db-export.c
diff options
context:
space:
mode:
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}