db-export.h 3.8 KB

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