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
,
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
,
34 const char *hierarchy
);
35 typedef void(tr2_tgt_evt_command_mode_fl_t
)(const char *file
, int line
,
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
,
47 uint64_t us_elapsed_child
);
49 typedef void(tr2_tgt_evt_thread_start_fl_t
)(const char *file
, int line
,
50 uint64_t us_elapsed_absolute
);
51 typedef void(tr2_tgt_evt_thread_exit_fl_t
)(const char *file
, int line
,
52 uint64_t us_elapsed_absolute
,
53 uint64_t us_elapsed_thread
);
55 typedef void(tr2_tgt_evt_exec_fl_t
)(const char *file
, int line
,
56 uint64_t us_elapsed_absolute
, int exec_id
,
57 const char *exe
, const char **argv
);
58 typedef void(tr2_tgt_evt_exec_result_fl_t
)(const char *file
, int line
,
59 uint64_t us_elapsed_absolute
,
60 int exec_id
, int code
);
62 typedef void(tr2_tgt_evt_param_fl_t
)(const char *file
, int line
,
63 const char *param
, const char *value
);
65 typedef void(tr2_tgt_evt_repo_fl_t
)(const char *file
, int line
,
66 const struct repository
*repo
);
68 typedef void(tr2_tgt_evt_region_enter_printf_va_fl_t
)(
69 const char *file
, int line
, uint64_t us_elapsed_absolute
,
70 const char *category
, const char *label
, const struct repository
*repo
,
71 const char *fmt
, va_list ap
);
72 typedef void(tr2_tgt_evt_region_leave_printf_va_fl_t
)(
73 const char *file
, int line
, uint64_t us_elapsed_absolute
,
74 uint64_t us_elapsed_region
, const char *category
, const char *label
,
75 const struct repository
*repo
, const char *fmt
, va_list ap
);
77 typedef void(tr2_tgt_evt_data_fl_t
)(const char *file
, int line
,
78 uint64_t us_elapsed_absolute
,
79 uint64_t us_elapsed_region
,
81 const struct repository
*repo
,
82 const char *key
, const char *value
);
83 typedef void(tr2_tgt_evt_data_json_fl_t
)(const char *file
, int line
,
84 uint64_t us_elapsed_absolute
,
85 uint64_t us_elapsed_region
,
87 const struct repository
*repo
,
89 const struct json_writer
*value
);
91 typedef void(tr2_tgt_evt_printf_va_fl_t
)(const char *file
, int line
,
92 uint64_t us_elapsed_absolute
,
93 const char *fmt
, va_list ap
);
96 * "vtable" for a TRACE2 target. Use NULL if a target does not want
97 * to emit that message.
99 /* clang-format off */
101 struct tr2_dst
*pdst
;
103 tr2_tgt_init_t
*pfn_init
;
104 tr2_tgt_term_t
*pfn_term
;
106 tr2_tgt_evt_version_fl_t
*pfn_version_fl
;
107 tr2_tgt_evt_start_fl_t
*pfn_start_fl
;
108 tr2_tgt_evt_exit_fl_t
*pfn_exit_fl
;
109 tr2_tgt_evt_signal_t
*pfn_signal
;
110 tr2_tgt_evt_atexit_t
*pfn_atexit
;
111 tr2_tgt_evt_error_va_fl_t
*pfn_error_va_fl
;
112 tr2_tgt_evt_command_path_fl_t
*pfn_command_path_fl
;
113 tr2_tgt_evt_command_ancestry_fl_t
*pfn_command_ancestry_fl
;
114 tr2_tgt_evt_command_name_fl_t
*pfn_command_name_fl
;
115 tr2_tgt_evt_command_mode_fl_t
*pfn_command_mode_fl
;
116 tr2_tgt_evt_alias_fl_t
*pfn_alias_fl
;
117 tr2_tgt_evt_child_start_fl_t
*pfn_child_start_fl
;
118 tr2_tgt_evt_child_exit_fl_t
*pfn_child_exit_fl
;
119 tr2_tgt_evt_thread_start_fl_t
*pfn_thread_start_fl
;
120 tr2_tgt_evt_thread_exit_fl_t
*pfn_thread_exit_fl
;
121 tr2_tgt_evt_exec_fl_t
*pfn_exec_fl
;
122 tr2_tgt_evt_exec_result_fl_t
*pfn_exec_result_fl
;
123 tr2_tgt_evt_param_fl_t
*pfn_param_fl
;
124 tr2_tgt_evt_repo_fl_t
*pfn_repo_fl
;
125 tr2_tgt_evt_region_enter_printf_va_fl_t
*pfn_region_enter_printf_va_fl
;
126 tr2_tgt_evt_region_leave_printf_va_fl_t
*pfn_region_leave_printf_va_fl
;
127 tr2_tgt_evt_data_fl_t
*pfn_data_fl
;
128 tr2_tgt_evt_data_json_fl_t
*pfn_data_json_fl
;
129 tr2_tgt_evt_printf_va_fl_t
*pfn_printf_va_fl
;
131 /* clang-format on */
133 extern struct tr2_tgt tr2_tgt_event
;
134 extern struct tr2_tgt tr2_tgt_normal
;
135 extern struct tr2_tgt tr2_tgt_perf
;
137 #endif /* TR2_TGT_H */