THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
5.2KB

  1. #ifndef TR2_TGT_H
  2. #define TR2_TGT_H
  3. struct child_process;
  4. struct repository;
  5. struct json_writer;
  6. /*
  7. * Function prototypes for a TRACE2 "target" vtable.
  8. */
  9. typedef int(tr2_tgt_init_t)(void);
  10. typedef void(tr2_tgt_term_t)(void);
  11. typedef void(tr2_tgt_evt_version_fl_t)(const char *file, int line);
  12. typedef void(tr2_tgt_evt_start_fl_t)(const char *file, int line,
  13. uint64_t us_elapsed_absolute,
  14. const char **argv);
  15. typedef void(tr2_tgt_evt_exit_fl_t)(const char *file, int line,
  16. uint64_t us_elapsed_absolute, int code);
  17. typedef void(tr2_tgt_evt_signal_t)(uint64_t us_elapsed_absolute, int signo);
  18. typedef void(tr2_tgt_evt_atexit_t)(uint64_t us_elapsed_absolute, int code);
  19. typedef void(tr2_tgt_evt_error_va_fl_t)(const char *file, int line,
  20. const char *fmt, va_list ap);
  21. typedef void(tr2_tgt_evt_command_path_fl_t)(const char *file, int line,
  22. const char *command_path);
  23. typedef void(tr2_tgt_evt_command_name_fl_t)(const char *file, int line,
  24. const char *name,
  25. const char *hierarchy);
  26. typedef void(tr2_tgt_evt_command_mode_fl_t)(const char *file, int line,
  27. const char *mode);
  28. typedef void(tr2_tgt_evt_alias_fl_t)(const char *file, int line,
  29. const char *alias, const char **argv);
  30. typedef void(tr2_tgt_evt_child_start_fl_t)(const char *file, int line,
  31. uint64_t us_elapsed_absolute,
  32. const struct child_process *cmd);
  33. typedef void(tr2_tgt_evt_child_exit_fl_t)(const char *file, int line,
  34. uint64_t us_elapsed_absolute, int cid,
  35. int pid, int code,
  36. uint64_t us_elapsed_child);
  37. typedef void(tr2_tgt_evt_thread_start_fl_t)(const char *file, int line,
  38. uint64_t us_elapsed_absolute);
  39. typedef void(tr2_tgt_evt_thread_exit_fl_t)(const char *file, int line,
  40. uint64_t us_elapsed_absolute,
  41. uint64_t us_elapsed_thread);
  42. typedef void(tr2_tgt_evt_exec_fl_t)(const char *file, int line,
  43. uint64_t us_elapsed_absolute, int exec_id,
  44. const char *exe, const char **argv);
  45. typedef void(tr2_tgt_evt_exec_result_fl_t)(const char *file, int line,
  46. uint64_t us_elapsed_absolute,
  47. int exec_id, int code);
  48. typedef void(tr2_tgt_evt_param_fl_t)(const char *file, int line,
  49. const char *param, const char *value);
  50. typedef void(tr2_tgt_evt_repo_fl_t)(const char *file, int line,
  51. const struct repository *repo);
  52. typedef void(tr2_tgt_evt_region_enter_printf_va_fl_t)(
  53. const char *file, int line, uint64_t us_elapsed_absolute,
  54. const char *category, const char *label, const struct repository *repo,
  55. const char *fmt, va_list ap);
  56. typedef void(tr2_tgt_evt_region_leave_printf_va_fl_t)(
  57. const char *file, int line, uint64_t us_elapsed_absolute,
  58. uint64_t us_elapsed_region, const char *category, const char *label,
  59. const struct repository *repo, const char *fmt, va_list ap);
  60. typedef void(tr2_tgt_evt_data_fl_t)(const char *file, int line,
  61. uint64_t us_elapsed_absolute,
  62. uint64_t us_elapsed_region,
  63. const char *category,
  64. const struct repository *repo,
  65. const char *key, const char *value);
  66. typedef void(tr2_tgt_evt_data_json_fl_t)(const char *file, int line,
  67. uint64_t us_elapsed_absolute,
  68. uint64_t us_elapsed_region,
  69. const char *category,
  70. const struct repository *repo,
  71. const char *key,
  72. const struct json_writer *value);
  73. typedef void(tr2_tgt_evt_printf_va_fl_t)(const char *file, int line,
  74. uint64_t us_elapsed_absolute,
  75. const char *fmt, va_list ap);
  76. /*
  77. * "vtable" for a TRACE2 target. Use NULL if a target does not want
  78. * to emit that message.
  79. */
  80. /* clang-format off */
  81. struct tr2_tgt {
  82. struct tr2_dst *pdst;
  83. tr2_tgt_init_t *pfn_init;
  84. tr2_tgt_term_t *pfn_term;
  85. tr2_tgt_evt_version_fl_t *pfn_version_fl;
  86. tr2_tgt_evt_start_fl_t *pfn_start_fl;
  87. tr2_tgt_evt_exit_fl_t *pfn_exit_fl;
  88. tr2_tgt_evt_signal_t *pfn_signal;
  89. tr2_tgt_evt_atexit_t *pfn_atexit;
  90. tr2_tgt_evt_error_va_fl_t *pfn_error_va_fl;
  91. tr2_tgt_evt_command_path_fl_t *pfn_command_path_fl;
  92. tr2_tgt_evt_command_name_fl_t *pfn_command_name_fl;
  93. tr2_tgt_evt_command_mode_fl_t *pfn_command_mode_fl;
  94. tr2_tgt_evt_alias_fl_t *pfn_alias_fl;
  95. tr2_tgt_evt_child_start_fl_t *pfn_child_start_fl;
  96. tr2_tgt_evt_child_exit_fl_t *pfn_child_exit_fl;
  97. tr2_tgt_evt_thread_start_fl_t *pfn_thread_start_fl;
  98. tr2_tgt_evt_thread_exit_fl_t *pfn_thread_exit_fl;
  99. tr2_tgt_evt_exec_fl_t *pfn_exec_fl;
  100. tr2_tgt_evt_exec_result_fl_t *pfn_exec_result_fl;
  101. tr2_tgt_evt_param_fl_t *pfn_param_fl;
  102. tr2_tgt_evt_repo_fl_t *pfn_repo_fl;
  103. tr2_tgt_evt_region_enter_printf_va_fl_t *pfn_region_enter_printf_va_fl;
  104. tr2_tgt_evt_region_leave_printf_va_fl_t *pfn_region_leave_printf_va_fl;
  105. tr2_tgt_evt_data_fl_t *pfn_data_fl;
  106. tr2_tgt_evt_data_json_fl_t *pfn_data_json_fl;
  107. tr2_tgt_evt_printf_va_fl_t *pfn_printf_va_fl;
  108. };
  109. /* clang-format on */
  110. extern struct tr2_tgt tr2_tgt_event;
  111. extern struct tr2_tgt tr2_tgt_normal;
  112. extern struct tr2_tgt tr2_tgt_perf;
  113. #endif /* TR2_TGT_H */