Lines Matching full: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__set_db_id(dso, ++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(thread__maps(al->thread))); 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()
264 db_ids_from_al(dbe, &al, &dso_db_id, &sym_db_id, &offset); in call_path_from_sample()
267 current = call_path__findnew(dbe->cpr, current, in call_path_from_sample()
278 if (current == &dbe->cpr->call_path) { in call_path_from_sample()
286 int db_export__branch_type(struct db_export *dbe, u32 branch_type, in db_export__branch_type() argument
289 if (dbe->export_branch_type) in db_export__branch_type()
290 return dbe->export_branch_type(dbe, branch_type, name); in db_export__branch_type()
295 static int db_export__threads(struct db_export *dbe, struct thread *thread, in db_export__threads() argument
308 err = db_export__thread(dbe, main_thread, machine, main_thread); in db_export__threads()
317 err = db_export__exec_comm(dbe, comm, main_thread); in db_export__threads()
331 err = db_export__thread(dbe, thread, machine, main_thread); in db_export__threads()
336 err = db_export__comm_thread(dbe, comm, thread); in db_export__threads()
344 return db_export__comm(dbe, curr_comm, thread); in db_export__threads()
349 int db_export__sample(struct db_export *dbe, union perf_event *event, in db_export__sample() argument
370 err = db_export__evsel(dbe, evsel); in db_export__sample()
374 err = db_export__machine(dbe, machine); in db_export__sample()
380 err = db_export__threads(dbe, thread, main_thread, machine, &comm); in db_export__sample()
387 es.db_id = ++dbe->sample_last_db_id; in db_export__sample()
389 err = db_ids_from_al(dbe, al, &es.dso_db_id, &es.sym_db_id, &es.offset); in db_export__sample()
393 if (dbe->cpr) { in db_export__sample()
394 struct call_path *cp = call_path_from_sample(dbe, machine, in db_export__sample()
398 db_export__call_path(dbe, cp); in db_export__sample()
404 err = db_ids_from_al(dbe, addr_al, &es.addr_dso_db_id, in db_export__sample()
408 if (dbe->crp) { in db_export__sample()
411 dbe->crp); in db_export__sample()
417 if (dbe->export_sample) in db_export__sample()
418 err = dbe->export_sample(dbe, &es); in db_export__sample()
453 int db_export__branch_types(struct db_export *dbe) in db_export__branch_types() argument
458 err = db_export__branch_type(dbe, branch_types[i].branch_type, in db_export__branch_types()
475 err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_BEGIN, buf); in db_export__branch_types()
480 err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_END, buf); in db_export__branch_types()
488 int db_export__call_path(struct db_export *dbe, struct call_path *cp) in db_export__call_path() argument
496 err = db_export__call_path(dbe, cp->parent); in db_export__call_path()
501 cp->db_id = ++dbe->call_path_last_db_id; in db_export__call_path()
503 if (dbe->export_call_path) in db_export__call_path()
504 return dbe->export_call_path(dbe, cp); in db_export__call_path()
509 int db_export__call_return(struct db_export *dbe, struct call_return *cr, in db_export__call_return() argument
514 err = db_export__call_path(dbe, cr->cp); in db_export__call_return()
519 cr->db_id = ++dbe->call_return_last_db_id; in db_export__call_return()
523 *parent_db_id = ++dbe->call_return_last_db_id; in db_export__call_return()
527 if (dbe->export_call_return) in db_export__call_return()
528 return dbe->export_call_return(dbe, cr); in db_export__call_return()
533 static int db_export__pid_tid(struct db_export *dbe, struct machine *machine, in db_export__pid_tid() argument
548 err = db_export__threads(dbe, thread, main_thread, machine, comm_ptr); in db_export__pid_tid()
559 int db_export__switch(struct db_export *dbe, union perf_event *event, in db_export__switch() argument
575 err = db_export__machine(dbe, machine); in db_export__switch()
579 err = db_export__pid_tid(dbe, machine, sample->pid, sample->tid, in db_export__switch()
588 err = db_export__pid_tid(dbe, machine, pid, tid, &th_b_id, in db_export__switch()
601 db_id = ++dbe->context_switch_last_db_id; in db_export__switch()
615 if (dbe->export_context_switch) in db_export__switch()
616 return dbe->export_context_switch(dbe, db_id, machine, sample, in db_export__switch()