Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * db-export.h: Support for exporting data suitable for import to a database
0004  * Copyright (c) 2014, Intel Corporation.
0005  */
0006 
0007 #ifndef __PERF_DB_EXPORT_H
0008 #define __PERF_DB_EXPORT_H
0009 
0010 #include <linux/types.h>
0011 #include <linux/list.h>
0012 
0013 struct evsel;
0014 struct machine;
0015 struct thread;
0016 struct comm;
0017 struct dso;
0018 struct perf_sample;
0019 struct addr_location;
0020 struct call_return_processor;
0021 struct call_path_root;
0022 struct call_path;
0023 struct call_return;
0024 
0025 struct export_sample {
0026     union perf_event    *event;
0027     struct perf_sample  *sample;
0028     struct evsel        *evsel;
0029     struct addr_location    *al;
0030     u64         db_id;
0031     u64         comm_db_id;
0032     u64         dso_db_id;
0033     u64         sym_db_id;
0034     u64         offset; /* ip offset from symbol start */
0035     u64         addr_dso_db_id;
0036     u64         addr_sym_db_id;
0037     u64         addr_offset; /* addr offset from symbol start */
0038     u64         call_path_id;
0039 };
0040 
0041 struct db_export {
0042     int (*export_evsel)(struct db_export *dbe, struct evsel *evsel);
0043     int (*export_machine)(struct db_export *dbe, struct machine *machine);
0044     int (*export_thread)(struct db_export *dbe, struct thread *thread,
0045                  u64 main_thread_db_id, struct machine *machine);
0046     int (*export_comm)(struct db_export *dbe, struct comm *comm,
0047                struct thread *thread);
0048     int (*export_comm_thread)(struct db_export *dbe, u64 db_id,
0049                   struct comm *comm, struct thread *thread);
0050     int (*export_dso)(struct db_export *dbe, struct dso *dso,
0051               struct machine *machine);
0052     int (*export_symbol)(struct db_export *dbe, struct symbol *sym,
0053                  struct dso *dso);
0054     int (*export_branch_type)(struct db_export *dbe, u32 branch_type,
0055                   const char *name);
0056     int (*export_sample)(struct db_export *dbe, struct export_sample *es);
0057     int (*export_call_path)(struct db_export *dbe, struct call_path *cp);
0058     int (*export_call_return)(struct db_export *dbe,
0059                   struct call_return *cr);
0060     int (*export_context_switch)(struct db_export *dbe, u64 db_id,
0061                      struct machine *machine,
0062                      struct perf_sample *sample,
0063                      u64 th_out_id, u64 comm_out_id,
0064                      u64 th_in_id, u64 comm_in_id, int flags);
0065     struct call_return_processor *crp;
0066     struct call_path_root *cpr;
0067     u64 evsel_last_db_id;
0068     u64 machine_last_db_id;
0069     u64 thread_last_db_id;
0070     u64 comm_last_db_id;
0071     u64 comm_thread_last_db_id;
0072     u64 dso_last_db_id;
0073     u64 symbol_last_db_id;
0074     u64 sample_last_db_id;
0075     u64 call_path_last_db_id;
0076     u64 call_return_last_db_id;
0077     u64 context_switch_last_db_id;
0078 };
0079 
0080 int db_export__init(struct db_export *dbe);
0081 void db_export__exit(struct db_export *dbe);
0082 int db_export__evsel(struct db_export *dbe, struct evsel *evsel);
0083 int db_export__machine(struct db_export *dbe, struct machine *machine);
0084 int db_export__thread(struct db_export *dbe, struct thread *thread,
0085               struct machine *machine, struct thread *main_thread);
0086 int db_export__comm(struct db_export *dbe, struct comm *comm,
0087             struct thread *thread);
0088 int db_export__exec_comm(struct db_export *dbe, struct comm *comm,
0089              struct thread *main_thread);
0090 int db_export__comm_thread(struct db_export *dbe, struct comm *comm,
0091                struct thread *thread);
0092 int db_export__dso(struct db_export *dbe, struct dso *dso,
0093            struct machine *machine);
0094 int db_export__symbol(struct db_export *dbe, struct symbol *sym,
0095               struct dso *dso);
0096 int db_export__branch_type(struct db_export *dbe, u32 branch_type,
0097                const char *name);
0098 int db_export__sample(struct db_export *dbe, union perf_event *event,
0099               struct perf_sample *sample, struct evsel *evsel,
0100               struct addr_location *al, struct addr_location *addr_al);
0101 
0102 int db_export__branch_types(struct db_export *dbe);
0103 
0104 int db_export__call_path(struct db_export *dbe, struct call_path *cp);
0105 int db_export__call_return(struct db_export *dbe, struct call_return *cr,
0106                u64 *parent_db_id);
0107 int db_export__switch(struct db_export *dbe, union perf_event *event,
0108               struct perf_sample *sample, struct machine *machine);
0109 
0110 #endif