archive: improve documentation of --prefix
[git/debian.git] / trace2 / tr2_tgt.h
blob65f94e15748aa2497856a19afd6cc0de7f7736dc
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 uint64_t us_elapsed_absolute,
19 const char **argv);
20 typedef void(tr2_tgt_evt_exit_fl_t)(const char *file, int line,
21 uint64_t us_elapsed_absolute, int code);
22 typedef void(tr2_tgt_evt_signal_t)(uint64_t us_elapsed_absolute, int signo);
23 typedef void(tr2_tgt_evt_atexit_t)(uint64_t us_elapsed_absolute, int code);
25 typedef void(tr2_tgt_evt_error_va_fl_t)(const char *file, int line,
26 const char *fmt, va_list ap);
28 typedef void(tr2_tgt_evt_command_path_fl_t)(const char *file, int line,
29 const char *command_path);
30 typedef void(tr2_tgt_evt_command_ancestry_fl_t)(const char *file, int line,
31 const char **parent_names);
32 typedef void(tr2_tgt_evt_command_name_fl_t)(const char *file, int line,
33 const char *name,
34 const char *hierarchy);
35 typedef void(tr2_tgt_evt_command_mode_fl_t)(const char *file, int line,
36 const char *mode);
38 typedef void(tr2_tgt_evt_alias_fl_t)(const char *file, int line,
39 const char *alias, const char **argv);
41 typedef void(tr2_tgt_evt_child_start_fl_t)(const char *file, int line,
42 uint64_t us_elapsed_absolute,
43 const struct child_process *cmd);
44 typedef void(tr2_tgt_evt_child_exit_fl_t)(const char *file, int line,
45 uint64_t us_elapsed_absolute, int cid,
46 int pid, int code,
47 uint64_t us_elapsed_child);
48 typedef void(tr2_tgt_evt_child_ready_fl_t)(const char *file, int line,
49 uint64_t us_elapsed_absolute,
50 int cid, int pid, const char *ready,
51 uint64_t us_elapsed_child);
53 typedef void(tr2_tgt_evt_thread_start_fl_t)(const char *file, int line,
54 uint64_t us_elapsed_absolute);
55 typedef void(tr2_tgt_evt_thread_exit_fl_t)(const char *file, int line,
56 uint64_t us_elapsed_absolute,
57 uint64_t us_elapsed_thread);
59 typedef void(tr2_tgt_evt_exec_fl_t)(const char *file, int line,
60 uint64_t us_elapsed_absolute, int exec_id,
61 const char *exe, const char **argv);
62 typedef void(tr2_tgt_evt_exec_result_fl_t)(const char *file, int line,
63 uint64_t us_elapsed_absolute,
64 int exec_id, int code);
66 typedef void(tr2_tgt_evt_param_fl_t)(const char *file, int line,
67 const char *param, const char *value);
69 typedef void(tr2_tgt_evt_repo_fl_t)(const char *file, int line,
70 const struct repository *repo);
72 typedef void(tr2_tgt_evt_region_enter_printf_va_fl_t)(
73 const char *file, int line, uint64_t us_elapsed_absolute,
74 const char *category, const char *label, const struct repository *repo,
75 const char *fmt, va_list ap);
76 typedef void(tr2_tgt_evt_region_leave_printf_va_fl_t)(
77 const char *file, int line, uint64_t us_elapsed_absolute,
78 uint64_t us_elapsed_region, const char *category, const char *label,
79 const struct repository *repo, const char *fmt, va_list ap);
81 typedef void(tr2_tgt_evt_data_fl_t)(const char *file, int line,
82 uint64_t us_elapsed_absolute,
83 uint64_t us_elapsed_region,
84 const char *category,
85 const struct repository *repo,
86 const char *key, const char *value);
87 typedef void(tr2_tgt_evt_data_json_fl_t)(const char *file, int line,
88 uint64_t us_elapsed_absolute,
89 uint64_t us_elapsed_region,
90 const char *category,
91 const struct repository *repo,
92 const char *key,
93 const struct json_writer *value);
95 typedef void(tr2_tgt_evt_printf_va_fl_t)(const char *file, int line,
96 uint64_t us_elapsed_absolute,
97 const char *fmt, va_list ap);
100 * "vtable" for a TRACE2 target. Use NULL if a target does not want
101 * to emit that message.
103 /* clang-format off */
104 struct tr2_tgt {
105 struct tr2_dst *pdst;
107 tr2_tgt_init_t *pfn_init;
108 tr2_tgt_term_t *pfn_term;
110 tr2_tgt_evt_version_fl_t *pfn_version_fl;
111 tr2_tgt_evt_start_fl_t *pfn_start_fl;
112 tr2_tgt_evt_exit_fl_t *pfn_exit_fl;
113 tr2_tgt_evt_signal_t *pfn_signal;
114 tr2_tgt_evt_atexit_t *pfn_atexit;
115 tr2_tgt_evt_error_va_fl_t *pfn_error_va_fl;
116 tr2_tgt_evt_command_path_fl_t *pfn_command_path_fl;
117 tr2_tgt_evt_command_ancestry_fl_t *pfn_command_ancestry_fl;
118 tr2_tgt_evt_command_name_fl_t *pfn_command_name_fl;
119 tr2_tgt_evt_command_mode_fl_t *pfn_command_mode_fl;
120 tr2_tgt_evt_alias_fl_t *pfn_alias_fl;
121 tr2_tgt_evt_child_start_fl_t *pfn_child_start_fl;
122 tr2_tgt_evt_child_exit_fl_t *pfn_child_exit_fl;
123 tr2_tgt_evt_child_ready_fl_t *pfn_child_ready_fl;
124 tr2_tgt_evt_thread_start_fl_t *pfn_thread_start_fl;
125 tr2_tgt_evt_thread_exit_fl_t *pfn_thread_exit_fl;
126 tr2_tgt_evt_exec_fl_t *pfn_exec_fl;
127 tr2_tgt_evt_exec_result_fl_t *pfn_exec_result_fl;
128 tr2_tgt_evt_param_fl_t *pfn_param_fl;
129 tr2_tgt_evt_repo_fl_t *pfn_repo_fl;
130 tr2_tgt_evt_region_enter_printf_va_fl_t *pfn_region_enter_printf_va_fl;
131 tr2_tgt_evt_region_leave_printf_va_fl_t *pfn_region_leave_printf_va_fl;
132 tr2_tgt_evt_data_fl_t *pfn_data_fl;
133 tr2_tgt_evt_data_json_fl_t *pfn_data_json_fl;
134 tr2_tgt_evt_printf_va_fl_t *pfn_printf_va_fl;
136 /* clang-format on */
138 extern struct tr2_tgt tr2_tgt_event;
139 extern struct tr2_tgt tr2_tgt_normal;
140 extern struct tr2_tgt tr2_tgt_perf;
142 #endif /* TR2_TGT_H */