Lines Matching refs:dbe
24 int db_export__init(struct db_export *dbe) in db_export__init() argument
26 memset(dbe, 0, sizeof(struct db_export)); in db_export__init()
30 void db_export__exit(struct db_export *dbe) in db_export__exit() argument
32 call_return_processor__free(dbe->crp); in db_export__exit()
33 dbe->crp = NULL; in db_export__exit()
36 int db_export__evsel(struct db_export *dbe, struct evsel *evsel) in db_export__evsel() argument
41 evsel->db_id = ++dbe->evsel_last_db_id; in db_export__evsel()
43 if (dbe->export_evsel) in db_export__evsel()
44 return dbe->export_evsel(dbe, evsel); in db_export__evsel()
49 int db_export__machine(struct db_export *dbe, struct machine *machine) in db_export__machine() argument
54 machine->db_id = ++dbe->machine_last_db_id; in db_export__machine()
56 if (dbe->export_machine) in db_export__machine()
57 return dbe->export_machine(dbe, machine); in db_export__machine()
62 int db_export__thread(struct db_export *dbe, struct thread *thread, in db_export__thread() argument
70 thread__set_db_id(thread, ++dbe->thread_last_db_id); in db_export__thread()
75 if (dbe->export_thread) in db_export__thread()
76 return dbe->export_thread(dbe, thread, main_thread_db_id, in db_export__thread()
82 static int __db_export__comm(struct db_export *dbe, struct comm *comm, in __db_export__comm() argument
85 comm->db_id = ++dbe->comm_last_db_id; in __db_export__comm()
87 if (dbe->export_comm) in __db_export__comm()
88 return dbe->export_comm(dbe, comm, thread); in __db_export__comm()
93 int db_export__comm(struct db_export *dbe, struct comm *comm, in db_export__comm() argument
99 return __db_export__comm(dbe, comm, thread); in db_export__comm()
108 int db_export__exec_comm(struct db_export *dbe, struct comm *comm, in db_export__exec_comm() argument
116 err = __db_export__comm(dbe, comm, main_thread); in db_export__exec_comm()
130 return db_export__comm_thread(dbe, comm, main_thread); in db_export__exec_comm()
133 int db_export__comm_thread(struct db_export *dbe, struct comm *comm, in db_export__comm_thread() argument
138 db_id = ++dbe->comm_thread_last_db_id; in db_export__comm_thread()
140 if (dbe->export_comm_thread) in db_export__comm_thread()
141 return dbe->export_comm_thread(dbe, db_id, comm, thread); in db_export__comm_thread()
146 int db_export__dso(struct db_export *dbe, struct dso *dso, in db_export__dso() argument
152 dso->db_id = ++dbe->dso_last_db_id; in db_export__dso()
154 if (dbe->export_dso) in db_export__dso()
155 return dbe->export_dso(dbe, dso, machine); in db_export__dso()
160 int db_export__symbol(struct db_export *dbe, struct symbol *sym, in db_export__symbol() argument
168 *sym_db_id = ++dbe->symbol_last_db_id; in db_export__symbol()
170 if (dbe->export_symbol) in db_export__symbol()
171 return dbe->export_symbol(dbe, sym, dso); in db_export__symbol()
176 static int db_ids_from_al(struct db_export *dbe, struct addr_location *al, in db_ids_from_al() argument
184 err = db_export__dso(dbe, dso, maps__machine(al->maps)); in db_ids_from_al()
198 err = db_export__symbol(dbe, al->sym, dso); in db_ids_from_al()
209 static struct call_path *call_path_from_sample(struct db_export *dbe, in call_path_from_sample() argument
216 struct call_path *current = &dbe->cpr->call_path; in call_path_from_sample()
263 db_ids_from_al(dbe, &al, &dso_db_id, &sym_db_id, &offset); in call_path_from_sample()
266 current = call_path__findnew(dbe->cpr, current, in call_path_from_sample()
277 if (current == &dbe->cpr->call_path) { in call_path_from_sample()
285 int db_export__branch_type(struct db_export *dbe, u32 branch_type, in db_export__branch_type() argument
288 if (dbe->export_branch_type) in db_export__branch_type()
289 return dbe->export_branch_type(dbe, branch_type, name); in db_export__branch_type()
294 static int db_export__threads(struct db_export *dbe, struct thread *thread, in db_export__threads() argument
307 err = db_export__thread(dbe, main_thread, machine, main_thread); in db_export__threads()
316 err = db_export__exec_comm(dbe, comm, main_thread); in db_export__threads()
330 err = db_export__thread(dbe, thread, machine, main_thread); in db_export__threads()
335 err = db_export__comm_thread(dbe, comm, thread); in db_export__threads()
343 return db_export__comm(dbe, curr_comm, thread); in db_export__threads()
348 int db_export__sample(struct db_export *dbe, union perf_event *event, in db_export__sample() argument
364 err = db_export__evsel(dbe, evsel); in db_export__sample()
369 err = db_export__machine(dbe, machine); in db_export__sample()
375 err = db_export__threads(dbe, thread, main_thread, machine, &comm); in db_export__sample()
382 es.db_id = ++dbe->sample_last_db_id; in db_export__sample()
384 err = db_ids_from_al(dbe, al, &es.dso_db_id, &es.sym_db_id, &es.offset); in db_export__sample()
388 if (dbe->cpr) { in db_export__sample()
389 struct call_path *cp = call_path_from_sample(dbe, machine, in db_export__sample()
393 db_export__call_path(dbe, cp); in db_export__sample()
399 err = db_ids_from_al(dbe, addr_al, &es.addr_dso_db_id, in db_export__sample()
403 if (dbe->crp) { in db_export__sample()
406 dbe->crp); in db_export__sample()
412 if (dbe->export_sample) in db_export__sample()
413 err = dbe->export_sample(dbe, &es); in db_export__sample()
448 int db_export__branch_types(struct db_export *dbe) in db_export__branch_types() argument
453 err = db_export__branch_type(dbe, branch_types[i].branch_type, in db_export__branch_types()
470 err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_BEGIN, buf); in db_export__branch_types()
475 err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_END, buf); in db_export__branch_types()
483 int db_export__call_path(struct db_export *dbe, struct call_path *cp) in db_export__call_path() argument
491 err = db_export__call_path(dbe, cp->parent); in db_export__call_path()
496 cp->db_id = ++dbe->call_path_last_db_id; in db_export__call_path()
498 if (dbe->export_call_path) in db_export__call_path()
499 return dbe->export_call_path(dbe, cp); in db_export__call_path()
504 int db_export__call_return(struct db_export *dbe, struct call_return *cr, in db_export__call_return() argument
509 err = db_export__call_path(dbe, cr->cp); in db_export__call_return()
514 cr->db_id = ++dbe->call_return_last_db_id; in db_export__call_return()
518 *parent_db_id = ++dbe->call_return_last_db_id; in db_export__call_return()
522 if (dbe->export_call_return) in db_export__call_return()
523 return dbe->export_call_return(dbe, cr); in db_export__call_return()
528 static int db_export__pid_tid(struct db_export *dbe, struct machine *machine, in db_export__pid_tid() argument
543 err = db_export__threads(dbe, thread, main_thread, machine, comm_ptr); in db_export__pid_tid()
554 int db_export__switch(struct db_export *dbe, union perf_event *event, in db_export__switch() argument
570 err = db_export__machine(dbe, machine); in db_export__switch()
574 err = db_export__pid_tid(dbe, machine, sample->pid, sample->tid, in db_export__switch()
583 err = db_export__pid_tid(dbe, machine, pid, tid, &th_b_id, in db_export__switch()
596 db_id = ++dbe->context_switch_last_db_id; in db_export__switch()
610 if (dbe->export_context_switch) in db_export__switch()
611 return dbe->export_context_switch(dbe, db_id, machine, sample, in db_export__switch()