Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/trace2/tr2_tgt.h # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / trace2 / tr2_tgt.h` 160 lines ยท 6353 bytes Raw Blame History 1 #ifndef TR2_TGT_H 2 #define TR2_TGT_H 3 4 struct child_process; 5 struct repository; 6 struct json_writer; 7 struct tr2_timer_metadata; 8 struct tr2_timer; 9 struct tr2_counter_metadata; 10 struct tr2_counter; 11 12 #define NS_TO_SEC(ns) ((double)(ns) / 1.0e9) 13 14 /* 15 * Function prototypes for a TRACE2 "target" vtable. 16 */ 17 18 typedef int(tr2_tgt_init_t)(void); 19 typedef void(tr2_tgt_term_t)(void); 20 21 typedef void(tr2_tgt_evt_version_fl_t)(const char *file, int line); 22 23 typedef void(tr2_tgt_evt_start_fl_t)(const char *file, int line, 24 uint64_t us_elapsed_absolute, 25 const char **argv); 26 typedef void(tr2_tgt_evt_exit_fl_t)(const char *file, int line, 27 uint64_t us_elapsed_absolute, int code); 28 typedef void(tr2_tgt_evt_signal_t)(uint64_t us_elapsed_absolute, int signo); 29 typedef void(tr2_tgt_evt_atexit_t)(uint64_t us_elapsed_absolute, int code); 30 31 typedef void(tr2_tgt_evt_error_va_fl_t)(const char *file, int line, 32 const char *fmt, va_list ap); 33 34 typedef void(tr2_tgt_evt_command_path_fl_t)(const char *file, int line, 35 const char *command_path); 36 typedef void(tr2_tgt_evt_command_ancestry_fl_t)(const char *file, int line, 37 const char **parent_names); 38 typedef void(tr2_tgt_evt_command_name_fl_t)(const char *file, int line, 39 const char *name, 40 const char *hierarchy); 41 typedef void(tr2_tgt_evt_command_mode_fl_t)(const char *file, int line, 42 const char *mode); 43 44 typedef void(tr2_tgt_evt_alias_fl_t)(const char *file, int line, 45 const char *alias, const char **argv); 46 47 typedef void(tr2_tgt_evt_child_start_fl_t)(const char *file, int line, 48 uint64_t us_elapsed_absolute, 49 const struct child_process *cmd); 50 typedef void(tr2_tgt_evt_child_exit_fl_t)(const char *file, int line, 51 uint64_t us_elapsed_absolute, int cid, 52 int pid, int code, 53 uint64_t us_elapsed_child); 54 typedef void(tr2_tgt_evt_child_ready_fl_t)(const char *file, int line, 55 uint64_t us_elapsed_absolute, 56 int cid, int pid, const char *ready, 57 uint64_t us_elapsed_child); 58 59 typedef void(tr2_tgt_evt_thread_start_fl_t)(const char *file, int line, 60 uint64_t us_elapsed_absolute); 61 typedef void(tr2_tgt_evt_thread_exit_fl_t)(const char *file, int line, 62 uint64_t us_elapsed_absolute, 63 uint64_t us_elapsed_thread); 64 65 typedef void(tr2_tgt_evt_exec_fl_t)(const char *file, int line, 66 uint64_t us_elapsed_absolute, int exec_id, 67 const char *exe, const char **argv); 68 typedef void(tr2_tgt_evt_exec_result_fl_t)(const char *file, int line, 69 uint64_t us_elapsed_absolute, 70 int exec_id, int code); 71 72 struct key_value_info; 73 typedef void(tr2_tgt_evt_param_fl_t)(const char *file, int line, 74 const char *param, const char *value, 75 const struct key_value_info *kvi); 76 77 typedef void(tr2_tgt_evt_repo_fl_t)(const char *file, int line, 78 const struct repository *repo); 79 80 typedef void(tr2_tgt_evt_region_enter_printf_va_fl_t)( 81 const char *file, int line, uint64_t us_elapsed_absolute, 82 const char *category, const char *label, const struct repository *repo, 83 const char *fmt, va_list ap); 84 typedef void(tr2_tgt_evt_region_leave_printf_va_fl_t)( 85 const char *file, int line, uint64_t us_elapsed_absolute, 86 uint64_t us_elapsed_region, const char *category, const char *label, 87 const struct repository *repo, const char *fmt, va_list ap); 88 89 typedef void(tr2_tgt_evt_data_fl_t)(const char *file, int line, 90 uint64_t us_elapsed_absolute, 91 uint64_t us_elapsed_region, 92 const char *category, 93 const struct repository *repo, 94 const char *key, const char *value); 95 typedef void(tr2_tgt_evt_data_json_fl_t)(const char *file, int line, 96 uint64_t us_elapsed_absolute, 97 uint64_t us_elapsed_region, 98 const char *category, 99 const struct repository *repo, 100 const char *key, 101 const struct json_writer *value); 102 103 typedef void(tr2_tgt_evt_printf_va_fl_t)(const char *file, int line, 104 uint64_t us_elapsed_absolute, 105 const char *fmt, va_list ap); 106 107 typedef void(tr2_tgt_evt_timer_t)(const struct tr2_timer_metadata *meta, 108 const struct tr2_timer *timer, 109 int is_final_data); 110 111 typedef void(tr2_tgt_evt_counter_t)(const struct tr2_counter_metadata *meta, 112 const struct tr2_counter *counter, 113 int is_final_data); 114 115 /* 116 * "vtable" for a TRACE2 target. Use NULL if a target does not want 117 * to emit that message. 118 */ 119 /* clang-format off */ 120 struct tr2_tgt { 121 struct tr2_dst *pdst; 122 123 tr2_tgt_init_t *pfn_init; 124 tr2_tgt_term_t *pfn_term; 125 126 tr2_tgt_evt_version_fl_t *pfn_version_fl; 127 tr2_tgt_evt_start_fl_t *pfn_start_fl; 128 tr2_tgt_evt_exit_fl_t *pfn_exit_fl; 129 tr2_tgt_evt_signal_t *pfn_signal; 130 tr2_tgt_evt_atexit_t *pfn_atexit; 131 tr2_tgt_evt_error_va_fl_t *pfn_error_va_fl; 132 tr2_tgt_evt_command_path_fl_t *pfn_command_path_fl; 133 tr2_tgt_evt_command_ancestry_fl_t *pfn_command_ancestry_fl; 134 tr2_tgt_evt_command_name_fl_t *pfn_command_name_fl; 135 tr2_tgt_evt_command_mode_fl_t *pfn_command_mode_fl; 136 tr2_tgt_evt_alias_fl_t *pfn_alias_fl; 137 tr2_tgt_evt_child_start_fl_t *pfn_child_start_fl; 138 tr2_tgt_evt_child_exit_fl_t *pfn_child_exit_fl; 139 tr2_tgt_evt_child_ready_fl_t *pfn_child_ready_fl; 140 tr2_tgt_evt_thread_start_fl_t *pfn_thread_start_fl; 141 tr2_tgt_evt_thread_exit_fl_t *pfn_thread_exit_fl; 142 tr2_tgt_evt_exec_fl_t *pfn_exec_fl; 143 tr2_tgt_evt_exec_result_fl_t *pfn_exec_result_fl; 144 tr2_tgt_evt_param_fl_t *pfn_param_fl; 145 tr2_tgt_evt_repo_fl_t *pfn_repo_fl; 146 tr2_tgt_evt_region_enter_printf_va_fl_t *pfn_region_enter_printf_va_fl; 147 tr2_tgt_evt_region_leave_printf_va_fl_t *pfn_region_leave_printf_va_fl; 148 tr2_tgt_evt_data_fl_t *pfn_data_fl; 149 tr2_tgt_evt_data_json_fl_t *pfn_data_json_fl; 150 tr2_tgt_evt_printf_va_fl_t *pfn_printf_va_fl; 151 tr2_tgt_evt_timer_t *pfn_timer; 152 tr2_tgt_evt_counter_t *pfn_counter; 153 }; 154 /* clang-format on */ 155 156 extern struct tr2_tgt tr2_tgt_event; 157 extern struct tr2_tgt tr2_tgt_normal; 158 extern struct tr2_tgt tr2_tgt_perf; 159 160 #endif /* TR2_TGT_H */