sha1-name.c: add repo_find_unique_abbrev_r()
[git.git] / trace2 / tr2_tgt.h
blob297bb8ffbe498358b41e697c892c259871a6a937
1 #ifndef TR2_TGT_H
2 #define TR2_TGT_H
4 struct child_process;
5 struct repository;
6 struct json_writer;
8 /*
9 * Function prototypes for a TRACE2 "target" vtable.
12 typedef int(tr2_tgt_init_t)(void);
13 typedef void(tr2_tgt_term_t)(void);
15 typedef void(tr2_tgt_evt_version_fl_t)(const char *file, int line);
17 typedef void(tr2_tgt_evt_start_fl_t)(const char *file, int line,
18 const char **argv);
19 typedef void(tr2_tgt_evt_exit_fl_t)(const char *file, int line,
20 uint64_t us_elapsed_absolute, int code);
21 typedef void(tr2_tgt_evt_signal_t)(uint64_t us_elapsed_absolute, int signo);
22 typedef void(tr2_tgt_evt_atexit_t)(uint64_t us_elapsed_absolute, int code);
24 typedef void(tr2_tgt_evt_error_va_fl_t)(const char *file, int line,
25 const char *fmt, va_list ap);
27 typedef void(tr2_tgt_evt_command_path_fl_t)(const char *file, int line,
28 const char *command_path);
29 typedef void(tr2_tgt_evt_command_name_fl_t)(const char *file, int line,
30 const char *name,
31 const char *hierarchy);
32 typedef void(tr2_tgt_evt_command_mode_fl_t)(const char *file, int line,
33 const char *mode);
35 typedef void(tr2_tgt_evt_alias_fl_t)(const char *file, int line,
36 const char *alias, const char **argv);
38 typedef 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);
41 typedef 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);
46 typedef void(tr2_tgt_evt_thread_start_fl_t)(const char *file, int line,
47 uint64_t us_elapsed_absolute);
48 typedef 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);
52 typedef 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);
55 typedef 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);
59 typedef void(tr2_tgt_evt_param_fl_t)(const char *file, int line,
60 const char *param, const char *value);
62 typedef void(tr2_tgt_evt_repo_fl_t)(const char *file, int line,
63 const struct repository *repo);
65 typedef 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);
69 typedef 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);
74 typedef 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);
80 typedef 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);
88 typedef 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);
93 * "vtable" for a TRACE2 target. Use NULL if a target does not want
94 * to emit that message.
96 /* clang-format off */
97 struct tr2_tgt {
98 struct tr2_dst *pdst;
100 tr2_tgt_init_t *pfn_init;
101 tr2_tgt_term_t *pfn_term;
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;
127 /* clang-format on */
129 extern struct tr2_tgt tr2_tgt_event;
130 extern struct tr2_tgt tr2_tgt_normal;
131 extern struct tr2_tgt tr2_tgt_perf;
133 #endif /* TR2_TGT_H */