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->db_id = ++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, al->maps->machine); 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()
260 db_ids_from_al(dbe, &al, &dso_db_id, &sym_db_id, &offset); in call_path_from_sample()
263 current = call_path__findnew(dbe->cpr, current, in call_path_from_sample()
273 if (current == &dbe->cpr->call_path) { in call_path_from_sample()
281 int db_export__branch_type(struct db_export *dbe, u32 branch_type, in db_export__branch_type() argument
284 if (dbe->export_branch_type) in db_export__branch_type()
285 return dbe->export_branch_type(dbe, branch_type, name); in db_export__branch_type()
290 static int db_export__threads(struct db_export *dbe, struct thread *thread, in db_export__threads() argument
303 err = db_export__thread(dbe, main_thread, machine, main_thread); in db_export__threads()
312 err = db_export__exec_comm(dbe, comm, main_thread); in db_export__threads()
326 err = db_export__thread(dbe, thread, machine, main_thread); in db_export__threads()
331 err = db_export__comm_thread(dbe, comm, thread); in db_export__threads()
339 return db_export__comm(dbe, curr_comm, thread); in db_export__threads()
344 int db_export__sample(struct db_export *dbe, union perf_event *event, in db_export__sample() argument
359 err = db_export__evsel(dbe, evsel); in db_export__sample()
363 err = db_export__machine(dbe, al->maps->machine); in db_export__sample()
369 err = db_export__threads(dbe, thread, main_thread, al->maps->machine, &comm); in db_export__sample()
376 es.db_id = ++dbe->sample_last_db_id; in db_export__sample()
378 err = db_ids_from_al(dbe, al, &es.dso_db_id, &es.sym_db_id, &es.offset); in db_export__sample()
382 if (dbe->cpr) { in db_export__sample()
383 struct call_path *cp = call_path_from_sample(dbe, al->maps->machine, in db_export__sample()
387 db_export__call_path(dbe, cp); in db_export__sample()
393 err = db_ids_from_al(dbe, addr_al, &es.addr_dso_db_id, in db_export__sample()
397 if (dbe->crp) { in db_export__sample()
400 dbe->crp); in db_export__sample()
406 if (dbe->export_sample) in db_export__sample()
407 err = dbe->export_sample(dbe, &es); in db_export__sample()
442 int db_export__branch_types(struct db_export *dbe) in db_export__branch_types() argument
447 err = db_export__branch_type(dbe, branch_types[i].branch_type, in db_export__branch_types()
464 err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_BEGIN, buf); in db_export__branch_types()
469 err = db_export__branch_type(dbe, type | PERF_IP_FLAG_TRACE_END, buf); in db_export__branch_types()
477 int db_export__call_path(struct db_export *dbe, struct call_path *cp) in db_export__call_path() argument
485 err = db_export__call_path(dbe, cp->parent); in db_export__call_path()
490 cp->db_id = ++dbe->call_path_last_db_id; in db_export__call_path()
492 if (dbe->export_call_path) in db_export__call_path()
493 return dbe->export_call_path(dbe, cp); in db_export__call_path()
498 int db_export__call_return(struct db_export *dbe, struct call_return *cr, in db_export__call_return() argument
503 err = db_export__call_path(dbe, cr->cp); in db_export__call_return()
508 cr->db_id = ++dbe->call_return_last_db_id; in db_export__call_return()
512 *parent_db_id = ++dbe->call_return_last_db_id; in db_export__call_return()
516 if (dbe->export_call_return) in db_export__call_return()
517 return dbe->export_call_return(dbe, cr); in db_export__call_return()
522 static int db_export__pid_tid(struct db_export *dbe, struct machine *machine, in db_export__pid_tid() argument
537 err = db_export__threads(dbe, thread, main_thread, machine, comm_ptr); in db_export__pid_tid()
548 int db_export__switch(struct db_export *dbe, union perf_event *event, in db_export__switch() argument
564 err = db_export__machine(dbe, machine); in db_export__switch()
568 err = db_export__pid_tid(dbe, machine, sample->pid, sample->tid, in db_export__switch()
577 err = db_export__pid_tid(dbe, machine, pid, tid, &th_b_id, in db_export__switch()
590 db_id = ++dbe->context_switch_last_db_id; in db_export__switch()
604 if (dbe->export_context_switch) in db_export__switch()
605 return dbe->export_context_switch(dbe, db_id, machine, sample, in db_export__switch()