1libtraceevent(3) 2================ 3 4NAME 5---- 6libtraceevent - Linux kernel trace event library 7 8SYNOPSIS 9-------- 10[verse] 11-- 12*#include <event-parse.h>* 13 14Management of tep handler data structure and access of its members: 15 struct tep_handle pass:[*]*tep_alloc*(void); 16 void *tep_free*(struct tep_handle pass:[*]_tep_); 17 void *tep_ref*(struct tep_handle pass:[*]_tep_); 18 void *tep_unref*(struct tep_handle pass:[*]_tep_); 19 int *tep_get_ref*(struct tep_handle pass:[*]_tep_); 20 void *tep_set_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_); 21 void *tep_clear_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_); 22 bool *tep_test_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flags_); 23 int *tep_get_cpus*(struct tep_handle pass:[*]_tep_); 24 void *tep_set_cpus*(struct tep_handle pass:[*]_tep_, int _cpus_); 25 int *tep_get_long_size*(strucqt tep_handle pass:[*]_tep_); 26 void *tep_set_long_size*(struct tep_handle pass:[*]_tep_, int _long_size_); 27 int *tep_get_page_size*(struct tep_handle pass:[*]_tep_); 28 void *tep_set_page_size*(struct tep_handle pass:[*]_tep_, int _page_size_); 29 int *tep_get_sub_buffer_size*(struct tep_handle pass:[*]_tep_); 30 int *tep_get_header_page_size*(struct tep_handle pass:[*]_tep_); 31 int *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_); 32 bool *tep_is_old_format*(struct tep_handle pass:[*]_tep_); 33 int *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_); 34 struct kbuffer pass:[*]*tep_kbuffer*(struct tep_handle pass:[*]:_tep_); 35 36Register / unregister APIs: 37 int *tep_register_function*(struct tep_handle pass:[*]_tep_, char pass:[*]_name_, unsigned long long _addr_, char pass:[*]_mod_); 38 int *tep_register_event_handler*(struct tep_handle pass:[*]_tep_, int _id_, const char pass:[*]_sys_name_, const char pass:[*]_event_name_, tep_event_handler_func _func_, void pass:[*]_context_); 39 int *tep_unregister_event_handler*(struct tep_handle pass:[*]tep, int id, const char pass:[*]sys_name, const char pass:[*]event_name, tep_event_handler_func func, void pass:[*]_context_); 40 int *tep_register_print_string*(struct tep_handle pass:[*]_tep_, const char pass:[*]_fmt_, unsigned long long _addr_); 41 int *tep_register_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, enum tep_func_arg_type _ret_type_, char pass:[*]_name_, _..._); 42 int *tep_unregister_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, char pass:[*]_name_); 43 int *tep_get_function_count*(struct tep_handle *_tep_); 44 45Trace printk parsing: 46 void *tep_print_printk*(struct tep_handle pass:[*]tep); 47 void *tep_print_funcs*(struct tep_handle pass:[*]tep); 48 void *tep_set_test_filters*(struct tep_handle pass:[*]tep, int test_filters); 49 void *tep_plugin_print_options*(struct trace_seq pass:[*]s); 50 int *tep_plugin_add_option*(const char pass:[*]_name_, const char pass:[*]_val_); 51 52Meta data parsing: 53 int *tep_parse_saved_cmdlines*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_); 54 int *tep_parse_printk_formats*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_); 55 int *tep_parse_kallsyms*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_); 56 57Plugins management: 58 struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_); 59 void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_); 60 char pass:[*]pass:[*]*tep_plugin_list_options*(void); 61 void *tep_plugin_free_options_list*(char pass:[*]pass:[*]_list_); 62 int *tep_plugin_add_options*(const char pass:[*]_name_, struct tep_plugin_option pass:[*]_options_); 63 void *tep_plugin_remove_options*(struct tep_plugin_option pass:[*]_options_); 64 void *tep_print_plugins*(struct trace_seq pass:[*]_s_, const char pass:[*]_prefix_, const char pass:[*]_suffix_, const struct tep_plugin_list pass:[*]_list_); 65 void *tep_load_plugins_hook*(struct tep_handle pass:[*]_tep_, const char pass:[*]_suffix_, 66 void (pass:[*]_load_plugin_)(struct tep_handle pass:[*]tep, 67 const char pass:[*]path, 68 const char pass:[*]name, 69 void pass:[*]data), 70 void pass:[*]_data_); 71 int *tep_add_plugin_path*(struct tep_handle pass:[*]tep, char pass:[*]path, 72 enum tep_plugin_load_priority prio); 73 74Event related APIs: 75 struct tep_event pass:[*]*tep_get_event*(struct tep_handle pass:[*]_tep_, int _index_); 76 struct tep_event pass:[*]*tep_get_first_event*(struct tep_handle pass:[*]_tep_); 77 int *tep_get_events_count*(struct tep_handle pass:[*]_tep_); 78 struct tep_event pass:[*]pass:[*]*tep_list_events*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_); 79 struct tep_event pass:[*]pass:[*]*tep_list_events_copy*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_); 80 void *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, const char pass:[*]_fmt_, _..._); 81 82Event finding: 83 struct tep_event pass:[*]*tep_find_event*(struct tep_handle pass:[*]_tep_, int _id_); 84 struct tep_event pass:[*]*tep_find_event_by_name*(struct tep_handle pass:[*]_tep_, const char pass:[*]_sys_, const char pass:[*]_name_); 85 struct tep_event pass:[*]*tep_find_event_by_record*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_record_); 86 87Parsing of event files: 88 int *tep_parse_header_page*(struct tep_handle pass:[*]_tep_, char pass:[*]_buf_, unsigned long _size_, int _long_size_); 89 enum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_); 90 enum tep_errno *tep_parse_format*(struct tep_handle pass:[*]_tep_, struct tep_event pass:[*]pass:[*]_eventp_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_); 91 92APIs related to fields from event's format files: 93 struct tep_format_field pass:[*]pass:[*]*tep_event_common_fields*(struct tep_event pass:[*]_event_); 94 struct tep_format_field pass:[*]pass:[*]*tep_event_fields*(struct tep_event pass:[*]_event_); 95 void pass:[*]*tep_get_field_raw*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int pass:[*]_len_, int _err_); 96 int *tep_get_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_); 97 int *tep_get_common_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_); 98 int *tep_get_any_field_val*(struct trace_seq pass:[*]_s_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, unsigned long long pass:[*]_val_, int _err_); 99 int *tep_read_number_field*(struct tep_format_field pass:[*]_field_, const void pass:[*]_data_, unsigned long long pass:[*]_value_); 100 101Event fields printing: 102 void *tep_print_field_content*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int size, struct tep_format_field pass:[*]_field_); 103 void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_); 104 int *tep_print_num_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_); 105 int *tep_print_func_field*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, struct tep_event pass:[*]_event_, const char pass:[*]_name_, struct tep_record pass:[*]_record_, int _err_); 106 void *tep_record_print_fields*(struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, struct tep_event pass:[*]_event_); 107 void *tep_record_print_selected_fields*(struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, struct tep_event pass:[*]_event_, int _select_mask_); 108 109Event fields finding: 110 struct tep_format_field pass:[*]*tep_find_common_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); 111 struct tep_format_field pass:[*]*tep_find_field*(struct tep_event_ormat pass:[*]_event_, const char pass:[*]_name_); 112 struct tep_format_field pass:[*]*tep_find_any_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); 113 114Functions resolver: 115 int *tep_set_function_resolver*(struct tep_handle pass:[*]_tep_, tep_func_resolver_t pass:[*]_func_, void pass:[*]_priv_); 116 void *tep_reset_function_resolver*(struct tep_handle pass:[*]_tep_); 117 const char pass:[*]*tep_find_function*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_); 118 unsigned long long *tep_find_function_address*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_); 119 int *tep_find_function_info*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_, const char pass:[**]_name_, 120 unsigned long long pass:[*]_start_, unsigned long pass:[*]_size_); 121 122Filter management: 123 struct tep_event_filter pass:[*]*tep_filter_alloc*(struct tep_handle pass:[*]_tep_); 124 enum tep_errno *tep_filter_add_filter_str*(struct tep_event_filter pass:[*]_filter_, const char pass:[*]_filter_str_); 125 enum tep_errno *tep_filter_match*(struct tep_event_filter pass:[*]_filter_, struct tep_record pass:[*]_record_); 126 int *tep_filter_strerror*(struct tep_event_filter pass:[*]_filter_, enum tep_errno _err_, char pass:[*]buf, size_t _buflen_); 127 int *tep_event_filtered*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 128 void *tep_filter_reset*(struct tep_event_filter pass:[*]_filter_); 129 void *tep_filter_free*(struct tep_event_filter pass:[*]_filter_); 130 char pass:[*]*tep_filter_make_string*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 131 int *tep_filter_remove_event*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 132 int *tep_filter_copy*(struct tep_event_filter pass:[*]_dest_, struct tep_event_filter pass:[*]_source_); 133 int *tep_filter_compare*(struct tep_event_filter pass:[*]_filter1_, struct tep_event_filter pass:[*]_filter2_); 134 135Parsing various data from the records: 136 int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 137 int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 138 int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 139 int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 140 141Command and task related APIs: 142 const char pass:[*]*tep_data_comm_from_pid*(struct tep_handle pass:[*]_tep_, int _pid_); 143 struct cmdline pass:[*]*tep_data_pid_from_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, struct cmdline pass:[*]_next_); 144 int *tep_register_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_); 145 int *tep_override_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_); 146 bool *tep_is_pid_registered*(struct tep_handle pass:[*]_tep_, int _pid_); 147 int *tep_cmdline_pid*(struct tep_handle pass:[*]_tep_, struct cmdline pass:[*]_cmdline_); 148 149Endian related APIs: 150 int *tep_is_bigendian*(void); 151 unsigned long long *tep_read_number*(struct tep_handle pass:[*]_tep_, const void pass:[*]_ptr_, int _size_); 152 bool *tep_is_file_bigendian*(struct tep_handle pass:[*]_tep_); 153 void *tep_set_file_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_); 154 bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_); 155 void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_); 156 157Control library logs: 158 int *tep_set_loglevel*(enum tep_loglevel _level_); 159 160KVM plugin calllbacks: (Defined by the application and complied with -rdynamic) 161 const char pass:[*]*tep_plugin_kvm_get_func*(struct tep_event pass:[*]event, 162 struct tep_record pass:[*]record, 163 unsigned long long pass:[*]paddr); 164 void *tep_plugin_kvm_put_func*(const char pass:[*]func); 165 166Trace sequences: 167*#include <trace-seq.h>* 168 void *trace_seq_init*(struct trace_seq pass:[*]_s_); 169 void *trace_seq_reset*(struct trace_seq pass:[*]_s_); 170 void *trace_seq_destroy*(struct trace_seq pass:[*]_s_); 171 int *trace_seq_printf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, ...); 172 int *trace_seq_vprintf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, va_list _args_); 173 int *trace_seq_puts*(struct trace_seq pass:[*]_s_, const char pass:[*]_str_); 174 int *trace_seq_putc*(struct trace_seq pass:[*]_s_, unsigned char _c_); 175 void *trace_seq_terminate*(struct trace_seq pass:[*]_s_); 176 int *trace_seq_do_fprintf*(struct trace_seq pass:[*]_s_, FILE pass:[*]_fp_); 177 int *trace_seq_do_printf*(struct trace_seq pass:[*]_s_); 178 179kbuffer parsing: 180#include <kbuffer.h> 181 struct kbuffer pass:[*]*kbuffer_alloc*(enum kbuffer_long_size _size_, enum kbuffer_endian _endian_); 182 void *kbuffer_free*(struct kbuffer pass:[*]_kbuf_); 183 int *kbuffer_load_subbuffer*(struct kbuffer pass:[*]_kbuf_, void pass:[*]_subbuffer_); 184 int *kbuffer_subbuffer_size*(struct kbuffer pass:[*]_kbuf); 185 int *kbuffer_start_of_data*(struct kbuffer pass:[*]_kbuf_); 186 unsigned long long *kbuffer_timestamp*(struct kbuffer pass:[*]_kbuf_); 187 unsigned long long *kbuffer_subbuf_timestamp*(struct kbuffer pass:[*]_kbuf_, void pass:[*]_subbuf_); 188 void pass:[*]*kbuffer_read_event*(struct kbuffer pass:[*]_kbuf_, unsigned long long pass:[*]_ts_); 189 void pass:[*]*kbuffer_next_event*(struct kbuffer pass:[*]_kbuf_, unsigned long long pass:[*]_ts_); 190 void pass:[*]*kbuffer_read_at_offset*(struct kbuffer pass:[*]_kbuf_, int _offset_, unsigned long long pass:[*]_ts_); 191 int *kbuffer_missed_events*(struct kbuffer pass:[*]_kbuf_); 192 int *kbuffer_event_size*(struct kbuffer pass:[*]_kbuf_); 193 int *kbuffer_curr_size*(struct kbuffer pass:[*]_kbuf_); 194 int *kbuffer_curr_offset*(struct kbuffer pass:[*]_kbuf_); 195 int *kbuffer_curr_index*(struct kbuffer pass:[*]_kbuf_); 196-- 197 198DESCRIPTION 199----------- 200The libtraceevent(3) library provides APIs to access kernel tracepoint events, 201located in the tracefs file system under the events directory. 202 203ENVIRONMENT 204----------- 205[verse] 206-- 207TRACEEVENT_PLUGIN_DIR 208 Additional plugin directory. All shared object files, located in this directory will be loaded as traceevent plugins. 209-- 210 211FILES 212----- 213[verse] 214-- 215*event-parse.h* 216 Header file to include in order to have access to the library APIs. 217*trace-seq.h* 218 Header file to include in order to have access to trace sequences related APIs. 219 Trace sequences are used to allow a function to call several other functions 220 to create a string of data to use. 221*-ltraceevent* 222 Linker switch to add when building a program that uses the library. 223-- 224 225SEE ALSO 226-------- 227*trace-cmd*(1) 228 229AUTHOR 230------ 231[verse] 232-- 233*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 234*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 235-- 236REPORTING BUGS 237-------------- 238Report bugs to <linux-trace-devel@vger.kernel.org> 239 240LICENSE 241------- 242libtraceevent is Free Software licensed under the GNU LGPL 2.1 243 244RESOURCES 245--------- 246https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ 247