db-export.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #ifndef __PERF_DB_EXPORT_H
  16. #define __PERF_DB_EXPORT_H
  17. #include <linux/types.h>
  18. struct perf_evsel;
  19. struct machine;
  20. struct thread;
  21. struct comm;
  22. struct dso;
  23. struct perf_sample;
  24. struct addr_location;
  25. struct export_sample {
  26. union perf_event *event;
  27. struct perf_sample *sample;
  28. struct perf_evsel *evsel;
  29. struct thread *thread;
  30. struct addr_location *al;
  31. u64 db_id;
  32. u64 comm_db_id;
  33. u64 dso_db_id;
  34. u64 sym_db_id;
  35. u64 offset; /* ip offset from symbol start */
  36. u64 addr_dso_db_id;
  37. u64 addr_sym_db_id;
  38. u64 addr_offset; /* addr offset from symbol start */
  39. };
  40. struct db_export {
  41. int (*export_evsel)(struct db_export *dbe, struct perf_evsel *evsel);
  42. int (*export_machine)(struct db_export *dbe, struct machine *machine);
  43. int (*export_thread)(struct db_export *dbe, struct thread *thread,
  44. u64 main_thread_db_id, struct machine *machine);
  45. int (*export_comm)(struct db_export *dbe, struct comm *comm);
  46. int (*export_comm_thread)(struct db_export *dbe, u64 db_id,
  47. struct comm *comm, struct thread *thread);
  48. int (*export_dso)(struct db_export *dbe, struct dso *dso,
  49. struct machine *machine);
  50. int (*export_symbol)(struct db_export *dbe, struct symbol *sym,
  51. struct dso *dso);
  52. int (*export_sample)(struct db_export *dbe, struct export_sample *es);
  53. u64 evsel_last_db_id;
  54. u64 machine_last_db_id;
  55. u64 thread_last_db_id;
  56. u64 comm_last_db_id;
  57. u64 comm_thread_last_db_id;
  58. u64 dso_last_db_id;
  59. u64 symbol_last_db_id;
  60. u64 sample_last_db_id;
  61. };
  62. int db_export__init(struct db_export *dbe);
  63. void db_export__exit(struct db_export *dbe);
  64. int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel);
  65. int db_export__machine(struct db_export *dbe, struct machine *machine);
  66. int db_export__thread(struct db_export *dbe, struct thread *thread,
  67. struct machine *machine, struct comm *comm);
  68. int db_export__comm(struct db_export *dbe, struct comm *comm,
  69. struct thread *main_thread);
  70. int db_export__comm_thread(struct db_export *dbe, struct comm *comm,
  71. struct thread *thread);
  72. int db_export__dso(struct db_export *dbe, struct dso *dso,
  73. struct machine *machine);
  74. int db_export__symbol(struct db_export *dbe, struct symbol *sym,
  75. struct dso *dso);
  76. int db_export__sample(struct db_export *dbe, union perf_event *event,
  77. struct perf_sample *sample, struct perf_evsel *evsel,
  78. struct thread *thread, struct addr_location *al);
  79. #endif