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