Linux Perf
db-export.h
Go to the documentation of this file.
1 /*
2  * db-export.h: Support for exporting data suitable for import to a database
3  * Copyright (c) 2014, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  */
15 
16 #ifndef __PERF_DB_EXPORT_H
17 #define __PERF_DB_EXPORT_H
18 
19 #include <linux/types.h>
20 #include <linux/list.h>
21 
22 struct perf_evsel;
23 struct machine;
24 struct thread;
25 struct comm;
26 struct dso;
27 struct perf_sample;
28 struct addr_location;
30 struct call_path_root;
31 struct call_path;
32 struct call_return;
33 
34 struct export_sample {
35  union perf_event *event;
37  struct perf_evsel *evsel;
38  struct addr_location *al;
39  u64 db_id;
41  u64 dso_db_id;
42  u64 sym_db_id;
43  u64 offset; /* ip offset from symbol start */
46  u64 addr_offset; /* addr offset from symbol start */
48 };
49 
50 struct db_export {
51  int (*export_evsel)(struct db_export *dbe, struct perf_evsel *evsel);
52  int (*export_machine)(struct db_export *dbe, struct machine *machine);
53  int (*export_thread)(struct db_export *dbe, struct thread *thread,
54  u64 main_thread_db_id, struct machine *machine);
55  int (*export_comm)(struct db_export *dbe, struct comm *comm);
56  int (*export_comm_thread)(struct db_export *dbe, u64 db_id,
57  struct comm *comm, struct thread *thread);
58  int (*export_dso)(struct db_export *dbe, struct dso *dso,
59  struct machine *machine);
60  int (*export_symbol)(struct db_export *dbe, struct symbol *sym,
61  struct dso *dso);
62  int (*export_branch_type)(struct db_export *dbe, u32 branch_type,
63  const char *name);
64  int (*export_sample)(struct db_export *dbe, struct export_sample *es);
65  int (*export_call_path)(struct db_export *dbe, struct call_path *cp);
66  int (*export_call_return)(struct db_export *dbe,
67  struct call_return *cr);
80  struct list_head deferred;
81 };
82 
83 int db_export__init(struct db_export *dbe);
84 int db_export__flush(struct db_export *dbe);
85 void db_export__exit(struct db_export *dbe);
86 int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel);
87 int db_export__machine(struct db_export *dbe, struct machine *machine);
88 int db_export__thread(struct db_export *dbe, struct thread *thread,
89  struct machine *machine, struct comm *comm);
90 int db_export__comm(struct db_export *dbe, struct comm *comm,
91  struct thread *main_thread);
92 int db_export__comm_thread(struct db_export *dbe, struct comm *comm,
93  struct thread *thread);
94 int db_export__dso(struct db_export *dbe, struct dso *dso,
95  struct machine *machine);
96 int db_export__symbol(struct db_export *dbe, struct symbol *sym,
97  struct dso *dso);
98 int db_export__branch_type(struct db_export *dbe, u32 branch_type,
99  const char *name);
100 int db_export__sample(struct db_export *dbe, union perf_event *event,
101  struct perf_sample *sample, struct perf_evsel *evsel,
102  struct addr_location *al);
103 
104 int db_export__branch_types(struct db_export *dbe);
105 
106 int db_export__call_path(struct db_export *dbe, struct call_path *cp);
107 int db_export__call_return(struct db_export *dbe, struct call_return *cr);
108 
109 #endif
const char * comm
Definition: hists_common.c:16
int db_export__sample(struct db_export *dbe, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct addr_location *al)
Definition: db-export.c:350
u64 evsel_last_db_id
Definition: db-export.h:70
u64 dso_last_db_id
Definition: db-export.h:75
u64 addr_dso_db_id
Definition: db-export.h:44
struct addr_location * al
Definition: db-export.h:38
int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel)
Definition: db-export.c:98
u32 branch_type
Definition: db-export.c:431
u64 call_return_last_db_id
Definition: db-export.h:79
int db_export__init(struct db_export *dbe)
Definition: db-export.c:79
u64 comm_thread_last_db_id
Definition: db-export.h:74
u64 addr_offset
Definition: db-export.h:46
u64 sample_last_db_id
Definition: db-export.h:77
u64 call_path_last_db_id
Definition: db-export.h:78
u64 machine_last_db_id
Definition: db-export.h:71
u64 comm_last_db_id
Definition: db-export.h:73
int db_export__machine(struct db_export *dbe, struct machine *machine)
Definition: db-export.c:111
struct perf_sample * sample
Definition: db-export.h:36
Definition: comm.h:11
struct call_path_root * cpr
Definition: db-export.h:69
Definition: thread.h:18
const char * name
struct call_return_processor * crp
Definition: db-export.h:68
void db_export__exit(struct db_export *dbe)
Definition: db-export.c:91
int db_export__thread(struct db_export *dbe, struct thread *thread, struct machine *machine, struct comm *comm)
Definition: db-export.c:124
u64 thread_last_db_id
Definition: db-export.h:72
int db_export__symbol(struct db_export *dbe, struct symbol *sym, struct dso *dso)
Definition: db-export.c:220
int db_export__call_return(struct db_export *dbe, struct call_return *cr)
Definition: db-export.c:490
u64 comm_db_id
Definition: db-export.h:40
u64 addr_sym_db_id
Definition: db-export.h:45
u64 symbol_last_db_id
Definition: db-export.h:76
int db_export__comm(struct db_export *dbe, struct comm *comm, struct thread *main_thread)
Definition: db-export.c:171
Definition: dso.h:138
int db_export__call_path(struct db_export *dbe, struct call_path *cp)
Definition: db-export.c:469
int db_export__comm_thread(struct db_export *dbe, struct comm *comm, struct thread *thread)
Definition: db-export.c:193
union perf_event * event
Definition: db-export.h:35
u64 call_path_id
Definition: db-export.h:47
int db_export__branch_types(struct db_export *dbe)
Definition: db-export.c:456
static int sym(yyscan_t scanner, int type, int config)
struct perf_evsel * evsel
Definition: db-export.h:37
Definition: symbol.h:55
int db_export__flush(struct db_export *dbe)
Definition: db-export.c:86
int db_export__branch_type(struct db_export *dbe, u32 branch_type, const char *name)
Definition: db-export.c:341
int db_export__dso(struct db_export *dbe, struct dso *dso, struct machine *machine)
Definition: db-export.c:206