Linux Audio

Check our new training course

In-person Linux kernel drivers training

Jun 16-20, 2025
Register
Loading...
v4.6
 
  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
 22struct perf_evsel;
 23struct machine;
 24struct thread;
 25struct comm;
 26struct dso;
 27struct perf_sample;
 28struct addr_location;
 29struct call_return_processor;
 
 30struct call_path;
 31struct call_return;
 32
 33struct export_sample {
 34	union perf_event	*event;
 35	struct perf_sample	*sample;
 36	struct perf_evsel	*evsel;
 37	struct addr_location	*al;
 38	u64			db_id;
 39	u64			comm_db_id;
 40	u64			dso_db_id;
 41	u64			sym_db_id;
 42	u64			offset; /* ip offset from symbol start */
 43	u64			addr_dso_db_id;
 44	u64			addr_sym_db_id;
 45	u64			addr_offset; /* addr offset from symbol start */
 
 46};
 47
 48struct db_export {
 49	int (*export_evsel)(struct db_export *dbe, struct perf_evsel *evsel);
 50	int (*export_machine)(struct db_export *dbe, struct machine *machine);
 51	int (*export_thread)(struct db_export *dbe, struct thread *thread,
 52			     u64 main_thread_db_id, struct machine *machine);
 53	int (*export_comm)(struct db_export *dbe, struct comm *comm);
 
 54	int (*export_comm_thread)(struct db_export *dbe, u64 db_id,
 55				  struct comm *comm, struct thread *thread);
 56	int (*export_dso)(struct db_export *dbe, struct dso *dso,
 57			  struct machine *machine);
 58	int (*export_symbol)(struct db_export *dbe, struct symbol *sym,
 59			     struct dso *dso);
 60	int (*export_branch_type)(struct db_export *dbe, u32 branch_type,
 61				  const char *name);
 62	int (*export_sample)(struct db_export *dbe, struct export_sample *es);
 63	int (*export_call_path)(struct db_export *dbe, struct call_path *cp);
 64	int (*export_call_return)(struct db_export *dbe,
 65				  struct call_return *cr);
 
 
 
 
 
 66	struct call_return_processor *crp;
 
 67	u64 evsel_last_db_id;
 68	u64 machine_last_db_id;
 69	u64 thread_last_db_id;
 70	u64 comm_last_db_id;
 71	u64 comm_thread_last_db_id;
 72	u64 dso_last_db_id;
 73	u64 symbol_last_db_id;
 74	u64 sample_last_db_id;
 75	u64 call_path_last_db_id;
 76	u64 call_return_last_db_id;
 77	struct list_head deferred;
 78};
 79
 80int db_export__init(struct db_export *dbe);
 81int db_export__flush(struct db_export *dbe);
 82void db_export__exit(struct db_export *dbe);
 83int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel);
 84int db_export__machine(struct db_export *dbe, struct machine *machine);
 85int db_export__thread(struct db_export *dbe, struct thread *thread,
 86		      struct machine *machine, struct comm *comm);
 87int db_export__comm(struct db_export *dbe, struct comm *comm,
 88		    struct thread *main_thread);
 
 
 89int db_export__comm_thread(struct db_export *dbe, struct comm *comm,
 90			   struct thread *thread);
 91int db_export__dso(struct db_export *dbe, struct dso *dso,
 92		   struct machine *machine);
 93int db_export__symbol(struct db_export *dbe, struct symbol *sym,
 94		      struct dso *dso);
 95int db_export__branch_type(struct db_export *dbe, u32 branch_type,
 96			   const char *name);
 97int db_export__sample(struct db_export *dbe, union perf_event *event,
 98		      struct perf_sample *sample, struct perf_evsel *evsel,
 99		      struct addr_location *al);
100
101int db_export__branch_types(struct db_export *dbe);
102
103int db_export__call_path(struct db_export *dbe, struct call_path *cp);
104int db_export__call_return(struct db_export *dbe, struct call_return *cr);
 
 
 
105
106#endif
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * db-export.h: Support for exporting data suitable for import to a database
  4 * Copyright (c) 2014, Intel Corporation.
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#ifndef __PERF_DB_EXPORT_H
  8#define __PERF_DB_EXPORT_H
  9
 10#include <linux/types.h>
 11#include <linux/list.h>
 12
 13struct evsel;
 14struct machine;
 15struct thread;
 16struct comm;
 17struct dso;
 18struct perf_sample;
 19struct addr_location;
 20struct call_return_processor;
 21struct call_path_root;
 22struct call_path;
 23struct call_return;
 24
 25struct export_sample {
 26	union perf_event	*event;
 27	struct perf_sample	*sample;
 28	struct evsel		*evsel;
 29	struct addr_location	*al;
 30	u64			db_id;
 31	u64			comm_db_id;
 32	u64			dso_db_id;
 33	u64			sym_db_id;
 34	u64			offset; /* ip offset from symbol start */
 35	u64			addr_dso_db_id;
 36	u64			addr_sym_db_id;
 37	u64			addr_offset; /* addr offset from symbol start */
 38	u64			call_path_id;
 39};
 40
 41struct db_export {
 42	int (*export_evsel)(struct db_export *dbe, struct evsel *evsel);
 43	int (*export_machine)(struct db_export *dbe, struct machine *machine);
 44	int (*export_thread)(struct db_export *dbe, struct thread *thread,
 45			     u64 main_thread_db_id, struct machine *machine);
 46	int (*export_comm)(struct db_export *dbe, struct comm *comm,
 47			   struct thread *thread);
 48	int (*export_comm_thread)(struct db_export *dbe, u64 db_id,
 49				  struct comm *comm, struct thread *thread);
 50	int (*export_dso)(struct db_export *dbe, struct dso *dso,
 51			  struct machine *machine);
 52	int (*export_symbol)(struct db_export *dbe, struct symbol *sym,
 53			     struct dso *dso);
 54	int (*export_branch_type)(struct db_export *dbe, u32 branch_type,
 55				  const char *name);
 56	int (*export_sample)(struct db_export *dbe, struct export_sample *es);
 57	int (*export_call_path)(struct db_export *dbe, struct call_path *cp);
 58	int (*export_call_return)(struct db_export *dbe,
 59				  struct call_return *cr);
 60	int (*export_context_switch)(struct db_export *dbe, u64 db_id,
 61				     struct machine *machine,
 62				     struct perf_sample *sample,
 63				     u64 th_out_id, u64 comm_out_id,
 64				     u64 th_in_id, u64 comm_in_id, int flags);
 65	struct call_return_processor *crp;
 66	struct call_path_root *cpr;
 67	u64 evsel_last_db_id;
 68	u64 machine_last_db_id;
 69	u64 thread_last_db_id;
 70	u64 comm_last_db_id;
 71	u64 comm_thread_last_db_id;
 72	u64 dso_last_db_id;
 73	u64 symbol_last_db_id;
 74	u64 sample_last_db_id;
 75	u64 call_path_last_db_id;
 76	u64 call_return_last_db_id;
 77	u64 context_switch_last_db_id;
 78};
 79
 80int db_export__init(struct db_export *dbe);
 
 81void db_export__exit(struct db_export *dbe);
 82int db_export__evsel(struct db_export *dbe, struct evsel *evsel);
 83int db_export__machine(struct db_export *dbe, struct machine *machine);
 84int db_export__thread(struct db_export *dbe, struct thread *thread,
 85		      struct machine *machine, struct thread *main_thread);
 86int db_export__comm(struct db_export *dbe, struct comm *comm,
 87		    struct thread *thread);
 88int db_export__exec_comm(struct db_export *dbe, struct comm *comm,
 89			 struct thread *main_thread);
 90int db_export__comm_thread(struct db_export *dbe, struct comm *comm,
 91			   struct thread *thread);
 92int db_export__dso(struct db_export *dbe, struct dso *dso,
 93		   struct machine *machine);
 94int db_export__symbol(struct db_export *dbe, struct symbol *sym,
 95		      struct dso *dso);
 96int db_export__branch_type(struct db_export *dbe, u32 branch_type,
 97			   const char *name);
 98int db_export__sample(struct db_export *dbe, union perf_event *event,
 99		      struct perf_sample *sample, struct evsel *evsel,
100		      struct addr_location *al, struct addr_location *addr_al);
101
102int db_export__branch_types(struct db_export *dbe);
103
104int db_export__call_path(struct db_export *dbe, struct call_path *cp);
105int db_export__call_return(struct db_export *dbe, struct call_return *cr,
106			   u64 *parent_db_id);
107int db_export__switch(struct db_export *dbe, union perf_event *event,
108		      struct perf_sample *sample, struct machine *machine);
109
110#endif