linux/tools/perf/util/db-export.h
<<
>>
Prefs
   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 evsel;
  23struct machine;
  24struct thread;
  25struct comm;
  26struct dso;
  27struct perf_sample;
  28struct addr_location;
  29struct call_return_processor;
  30struct call_path_root;
  31struct call_path;
  32struct call_return;
  33
  34struct export_sample {
  35        union perf_event        *event;
  36        struct perf_sample      *sample;
  37        struct evsel            *evsel;
  38        struct addr_location    *al;
  39        u64                     db_id;
  40        u64                     comm_db_id;
  41        u64                     dso_db_id;
  42        u64                     sym_db_id;
  43        u64                     offset; /* ip offset from symbol start */
  44        u64                     addr_dso_db_id;
  45        u64                     addr_sym_db_id;
  46        u64                     addr_offset; /* addr offset from symbol start */
  47        u64                     call_path_id;
  48};
  49
  50struct db_export {
  51        int (*export_evsel)(struct db_export *dbe, struct 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                           struct thread *thread);
  57        int (*export_comm_thread)(struct db_export *dbe, u64 db_id,
  58                                  struct comm *comm, struct thread *thread);
  59        int (*export_dso)(struct db_export *dbe, struct dso *dso,
  60                          struct machine *machine);
  61        int (*export_symbol)(struct db_export *dbe, struct symbol *sym,
  62                             struct dso *dso);
  63        int (*export_branch_type)(struct db_export *dbe, u32 branch_type,
  64                                  const char *name);
  65        int (*export_sample)(struct db_export *dbe, struct export_sample *es);
  66        int (*export_call_path)(struct db_export *dbe, struct call_path *cp);
  67        int (*export_call_return)(struct db_export *dbe,
  68                                  struct call_return *cr);
  69        int (*export_context_switch)(struct db_export *dbe, u64 db_id,
  70                                     struct machine *machine,
  71                                     struct perf_sample *sample,
  72                                     u64 th_out_id, u64 comm_out_id,
  73                                     u64 th_in_id, u64 comm_in_id, int flags);
  74        struct call_return_processor *crp;
  75        struct call_path_root *cpr;
  76        u64 evsel_last_db_id;
  77        u64 machine_last_db_id;
  78        u64 thread_last_db_id;
  79        u64 comm_last_db_id;
  80        u64 comm_thread_last_db_id;
  81        u64 dso_last_db_id;
  82        u64 symbol_last_db_id;
  83        u64 sample_last_db_id;
  84        u64 call_path_last_db_id;
  85        u64 call_return_last_db_id;
  86        u64 context_switch_last_db_id;
  87};
  88
  89int db_export__init(struct db_export *dbe);
  90void db_export__exit(struct db_export *dbe);
  91int db_export__evsel(struct db_export *dbe, struct evsel *evsel);
  92int db_export__machine(struct db_export *dbe, struct machine *machine);
  93int db_export__thread(struct db_export *dbe, struct thread *thread,
  94                      struct machine *machine, struct thread *main_thread);
  95int db_export__comm(struct db_export *dbe, struct comm *comm,
  96                    struct thread *thread);
  97int db_export__exec_comm(struct db_export *dbe, struct comm *comm,
  98                         struct thread *main_thread);
  99int db_export__comm_thread(struct db_export *dbe, struct comm *comm,
 100                           struct thread *thread);
 101int db_export__dso(struct db_export *dbe, struct dso *dso,
 102                   struct machine *machine);
 103int db_export__symbol(struct db_export *dbe, struct symbol *sym,
 104                      struct dso *dso);
 105int db_export__branch_type(struct db_export *dbe, u32 branch_type,
 106                           const char *name);
 107int db_export__sample(struct db_export *dbe, union perf_event *event,
 108                      struct perf_sample *sample, struct evsel *evsel,
 109                      struct addr_location *al);
 110
 111int db_export__branch_types(struct db_export *dbe);
 112
 113int db_export__call_path(struct db_export *dbe, struct call_path *cp);
 114int db_export__call_return(struct db_export *dbe, struct call_return *cr,
 115                           u64 *parent_db_id);
 116int db_export__switch(struct db_export *dbe, union perf_event *event,
 117                      struct perf_sample *sample, struct machine *machine);
 118
 119#endif
 120