18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * db-export.h: Support for exporting data suitable for import to a database 48c2ecf20Sopenharmony_ci * Copyright (c) 2014, Intel Corporation. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef __PERF_DB_EXPORT_H 88c2ecf20Sopenharmony_ci#define __PERF_DB_EXPORT_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci#include <linux/list.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistruct evsel; 148c2ecf20Sopenharmony_cistruct machine; 158c2ecf20Sopenharmony_cistruct thread; 168c2ecf20Sopenharmony_cistruct comm; 178c2ecf20Sopenharmony_cistruct dso; 188c2ecf20Sopenharmony_cistruct perf_sample; 198c2ecf20Sopenharmony_cistruct addr_location; 208c2ecf20Sopenharmony_cistruct call_return_processor; 218c2ecf20Sopenharmony_cistruct call_path_root; 228c2ecf20Sopenharmony_cistruct call_path; 238c2ecf20Sopenharmony_cistruct call_return; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_cistruct export_sample { 268c2ecf20Sopenharmony_ci union perf_event *event; 278c2ecf20Sopenharmony_ci struct perf_sample *sample; 288c2ecf20Sopenharmony_ci struct evsel *evsel; 298c2ecf20Sopenharmony_ci struct addr_location *al; 308c2ecf20Sopenharmony_ci u64 db_id; 318c2ecf20Sopenharmony_ci u64 comm_db_id; 328c2ecf20Sopenharmony_ci u64 dso_db_id; 338c2ecf20Sopenharmony_ci u64 sym_db_id; 348c2ecf20Sopenharmony_ci u64 offset; /* ip offset from symbol start */ 358c2ecf20Sopenharmony_ci u64 addr_dso_db_id; 368c2ecf20Sopenharmony_ci u64 addr_sym_db_id; 378c2ecf20Sopenharmony_ci u64 addr_offset; /* addr offset from symbol start */ 388c2ecf20Sopenharmony_ci u64 call_path_id; 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistruct db_export { 428c2ecf20Sopenharmony_ci int (*export_evsel)(struct db_export *dbe, struct evsel *evsel); 438c2ecf20Sopenharmony_ci int (*export_machine)(struct db_export *dbe, struct machine *machine); 448c2ecf20Sopenharmony_ci int (*export_thread)(struct db_export *dbe, struct thread *thread, 458c2ecf20Sopenharmony_ci u64 main_thread_db_id, struct machine *machine); 468c2ecf20Sopenharmony_ci int (*export_comm)(struct db_export *dbe, struct comm *comm, 478c2ecf20Sopenharmony_ci struct thread *thread); 488c2ecf20Sopenharmony_ci int (*export_comm_thread)(struct db_export *dbe, u64 db_id, 498c2ecf20Sopenharmony_ci struct comm *comm, struct thread *thread); 508c2ecf20Sopenharmony_ci int (*export_dso)(struct db_export *dbe, struct dso *dso, 518c2ecf20Sopenharmony_ci struct machine *machine); 528c2ecf20Sopenharmony_ci int (*export_symbol)(struct db_export *dbe, struct symbol *sym, 538c2ecf20Sopenharmony_ci struct dso *dso); 548c2ecf20Sopenharmony_ci int (*export_branch_type)(struct db_export *dbe, u32 branch_type, 558c2ecf20Sopenharmony_ci const char *name); 568c2ecf20Sopenharmony_ci int (*export_sample)(struct db_export *dbe, struct export_sample *es); 578c2ecf20Sopenharmony_ci int (*export_call_path)(struct db_export *dbe, struct call_path *cp); 588c2ecf20Sopenharmony_ci int (*export_call_return)(struct db_export *dbe, 598c2ecf20Sopenharmony_ci struct call_return *cr); 608c2ecf20Sopenharmony_ci int (*export_context_switch)(struct db_export *dbe, u64 db_id, 618c2ecf20Sopenharmony_ci struct machine *machine, 628c2ecf20Sopenharmony_ci struct perf_sample *sample, 638c2ecf20Sopenharmony_ci u64 th_out_id, u64 comm_out_id, 648c2ecf20Sopenharmony_ci u64 th_in_id, u64 comm_in_id, int flags); 658c2ecf20Sopenharmony_ci struct call_return_processor *crp; 668c2ecf20Sopenharmony_ci struct call_path_root *cpr; 678c2ecf20Sopenharmony_ci u64 evsel_last_db_id; 688c2ecf20Sopenharmony_ci u64 machine_last_db_id; 698c2ecf20Sopenharmony_ci u64 thread_last_db_id; 708c2ecf20Sopenharmony_ci u64 comm_last_db_id; 718c2ecf20Sopenharmony_ci u64 comm_thread_last_db_id; 728c2ecf20Sopenharmony_ci u64 dso_last_db_id; 738c2ecf20Sopenharmony_ci u64 symbol_last_db_id; 748c2ecf20Sopenharmony_ci u64 sample_last_db_id; 758c2ecf20Sopenharmony_ci u64 call_path_last_db_id; 768c2ecf20Sopenharmony_ci u64 call_return_last_db_id; 778c2ecf20Sopenharmony_ci u64 context_switch_last_db_id; 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ciint db_export__init(struct db_export *dbe); 818c2ecf20Sopenharmony_civoid db_export__exit(struct db_export *dbe); 828c2ecf20Sopenharmony_ciint db_export__evsel(struct db_export *dbe, struct evsel *evsel); 838c2ecf20Sopenharmony_ciint db_export__machine(struct db_export *dbe, struct machine *machine); 848c2ecf20Sopenharmony_ciint db_export__thread(struct db_export *dbe, struct thread *thread, 858c2ecf20Sopenharmony_ci struct machine *machine, struct thread *main_thread); 868c2ecf20Sopenharmony_ciint db_export__comm(struct db_export *dbe, struct comm *comm, 878c2ecf20Sopenharmony_ci struct thread *thread); 888c2ecf20Sopenharmony_ciint db_export__exec_comm(struct db_export *dbe, struct comm *comm, 898c2ecf20Sopenharmony_ci struct thread *main_thread); 908c2ecf20Sopenharmony_ciint db_export__comm_thread(struct db_export *dbe, struct comm *comm, 918c2ecf20Sopenharmony_ci struct thread *thread); 928c2ecf20Sopenharmony_ciint db_export__dso(struct db_export *dbe, struct dso *dso, 938c2ecf20Sopenharmony_ci struct machine *machine); 948c2ecf20Sopenharmony_ciint db_export__symbol(struct db_export *dbe, struct symbol *sym, 958c2ecf20Sopenharmony_ci struct dso *dso); 968c2ecf20Sopenharmony_ciint db_export__branch_type(struct db_export *dbe, u32 branch_type, 978c2ecf20Sopenharmony_ci const char *name); 988c2ecf20Sopenharmony_ciint db_export__sample(struct db_export *dbe, union perf_event *event, 998c2ecf20Sopenharmony_ci struct perf_sample *sample, struct evsel *evsel, 1008c2ecf20Sopenharmony_ci struct addr_location *al); 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ciint db_export__branch_types(struct db_export *dbe); 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ciint db_export__call_path(struct db_export *dbe, struct call_path *cp); 1058c2ecf20Sopenharmony_ciint db_export__call_return(struct db_export *dbe, struct call_return *cr, 1068c2ecf20Sopenharmony_ci u64 *parent_db_id); 1078c2ecf20Sopenharmony_ciint db_export__switch(struct db_export *dbe, union perf_event *event, 1088c2ecf20Sopenharmony_ci struct perf_sample *sample, struct machine *machine); 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci#endif 111