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_header_page_size*(struct tep_handle pass:[*]_tep_); 30 int *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_); 31 bool *tep_is_old_format*(struct tep_handle pass:[*]_tep_); 32 int *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_); 33 34Register / unregister APIs: 35 int *tep_register_function*(struct tep_handle pass:[*]_tep_, char pass:[*]_name_, unsigned long long _addr_, char pass:[*]_mod_); 36 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_); 37 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_); 38 int *tep_register_print_string*(struct tep_handle pass:[*]_tep_, const char pass:[*]_fmt_, unsigned long long _addr_); 39 int *tep_register_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, enum tep_func_arg_type _ret_type_, char pass:[*]_name_, _..._); 40 int *tep_unregister_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, char pass:[*]_name_); 41 42Plugins management: 43 struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_); 44 void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_); 45 char pass:[*]pass:[*]*tep_plugin_list_options*(void); 46 void *tep_plugin_free_options_list*(char pass:[*]pass:[*]_list_); 47 int *tep_plugin_add_options*(const char pass:[*]_name_, struct tep_plugin_option pass:[*]_options_); 48 void *tep_plugin_remove_options*(struct tep_plugin_option pass:[*]_options_); 49 void *tep_print_plugins*(struct trace_seq pass:[*]_s_, const char pass:[*]_prefix_, const char pass:[*]_suffix_, const struct tep_plugin_list pass:[*]_list_); 50 51Event related APIs: 52 struct tep_event pass:[*]*tep_get_event*(struct tep_handle pass:[*]_tep_, int _index_); 53 struct tep_event pass:[*]*tep_get_first_event*(struct tep_handle pass:[*]_tep_); 54 int *tep_get_events_count*(struct tep_handle pass:[*]_tep_); 55 struct tep_event pass:[*]pass:[*]*tep_list_events*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_); 56 struct tep_event pass:[*]pass:[*]*tep_list_events_copy*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_); 57 void *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, const char pass:[*]_fmt_, _..._); 58 59Event finding: 60 struct tep_event pass:[*]*tep_find_event*(struct tep_handle pass:[*]_tep_, int _id_); 61 struct tep_event pass:[*]*tep_find_event_by_name*(struct tep_handle pass:[*]_tep_, const char pass:[*]_sys_, const char pass:[*]_name_); 62 struct tep_event pass:[*]*tep_find_event_by_record*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_record_); 63 64Parsing of event files: 65 int *tep_parse_header_page*(struct tep_handle pass:[*]_tep_, char pass:[*]_buf_, unsigned long _size_, int _long_size_); 66 enum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_); 67 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_); 68 69APIs related to fields from event's format files: 70 struct tep_format_field pass:[*]pass:[*]*tep_event_common_fields*(struct tep_event pass:[*]_event_); 71 struct tep_format_field pass:[*]pass:[*]*tep_event_fields*(struct tep_event pass:[*]_event_); 72 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_); 73 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_); 74 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_); 75 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_); 76 int *tep_read_number_field*(struct tep_format_field pass:[*]_field_, const void pass:[*]_data_, unsigned long long pass:[*]_value_); 77 78Event fields printing: 79 void *tep_print_field*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, struct tep_format_field pass:[*]_field_); 80 void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_); 81 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_); 82 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_); 83 84Event fields finding: 85 struct tep_format_field pass:[*]*tep_find_common_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); 86 struct tep_format_field pass:[*]*tep_find_field*(struct tep_event_ormat pass:[*]_event_, const char pass:[*]_name_); 87 struct tep_format_field pass:[*]*tep_find_any_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); 88 89Functions resolver: 90 int *tep_set_function_resolver*(struct tep_handle pass:[*]_tep_, tep_func_resolver_t pass:[*]_func_, void pass:[*]_priv_); 91 void *tep_reset_function_resolver*(struct tep_handle pass:[*]_tep_); 92 const char pass:[*]*tep_find_function*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_); 93 unsigned long long *tep_find_function_address*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_); 94 95Filter management: 96 struct tep_event_filter pass:[*]*tep_filter_alloc*(struct tep_handle pass:[*]_tep_); 97 enum tep_errno *tep_filter_add_filter_str*(struct tep_event_filter pass:[*]_filter_, const char pass:[*]_filter_str_); 98 enum tep_errno *tep_filter_match*(struct tep_event_filter pass:[*]_filter_, struct tep_record pass:[*]_record_); 99 int *tep_filter_strerror*(struct tep_event_filter pass:[*]_filter_, enum tep_errno _err_, char pass:[*]buf, size_t _buflen_); 100 int *tep_event_filtered*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 101 void *tep_filter_reset*(struct tep_event_filter pass:[*]_filter_); 102 void *tep_filter_free*(struct tep_event_filter pass:[*]_filter_); 103 char pass:[*]*tep_filter_make_string*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 104 int *tep_filter_remove_event*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 105 int *tep_filter_copy*(struct tep_event_filter pass:[*]_dest_, struct tep_event_filter pass:[*]_source_); 106 int *tep_filter_compare*(struct tep_event_filter pass:[*]_filter1_, struct tep_event_filter pass:[*]_filter2_); 107 108Parsing various data from the records: 109 int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 110 int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 111 int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 112 int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 113 114Command and task related APIs: 115 const char pass:[*]*tep_data_comm_from_pid*(struct tep_handle pass:[*]_tep_, int _pid_); 116 struct cmdline pass:[*]*tep_data_pid_from_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, struct cmdline pass:[*]_next_); 117 int *tep_register_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_); 118 int *tep_override_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_); 119 bool *tep_is_pid_registered*(struct tep_handle pass:[*]_tep_, int _pid_); 120 int *tep_cmdline_pid*(struct tep_handle pass:[*]_tep_, struct cmdline pass:[*]_cmdline_); 121 122Endian related APIs: 123 int *tep_is_bigendian*(void); 124 unsigned long long *tep_read_number*(struct tep_handle pass:[*]_tep_, const void pass:[*]_ptr_, int _size_); 125 bool *tep_is_file_bigendian*(struct tep_handle pass:[*]_tep_); 126 void *tep_set_file_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_); 127 bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_); 128 void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_); 129 130Trace sequences: 131*#include <trace-seq.h>* 132 void *trace_seq_init*(struct trace_seq pass:[*]_s_); 133 void *trace_seq_reset*(struct trace_seq pass:[*]_s_); 134 void *trace_seq_destroy*(struct trace_seq pass:[*]_s_); 135 int *trace_seq_printf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, ...); 136 int *trace_seq_vprintf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, va_list _args_); 137 int *trace_seq_puts*(struct trace_seq pass:[*]_s_, const char pass:[*]_str_); 138 int *trace_seq_putc*(struct trace_seq pass:[*]_s_, unsigned char _c_); 139 void *trace_seq_terminate*(struct trace_seq pass:[*]_s_); 140 int *trace_seq_do_fprintf*(struct trace_seq pass:[*]_s_, FILE pass:[*]_fp_); 141 int *trace_seq_do_printf*(struct trace_seq pass:[*]_s_); 142-- 143 144DESCRIPTION 145----------- 146The libtraceevent(3) library provides APIs to access kernel tracepoint events, 147located in the tracefs file system under the events directory. 148 149ENVIRONMENT 150----------- 151[verse] 152-- 153TRACEEVENT_PLUGIN_DIR 154 Additional plugin directory. All shared object files, located in this directory will be loaded as traceevent plugins. 155-- 156 157FILES 158----- 159[verse] 160-- 161*event-parse.h* 162 Header file to include in order to have access to the library APIs. 163*trace-seq.h* 164 Header file to include in order to have access to trace sequences related APIs. 165 Trace sequences are used to allow a function to call several other functions 166 to create a string of data to use. 167*-ltraceevent* 168 Linker switch to add when building a program that uses the library. 169-- 170 171SEE ALSO 172-------- 173_trace-cmd(1)_ 174 175AUTHOR 176------ 177[verse] 178-- 179*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 180*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 181-- 182REPORTING BUGS 183-------------- 184Report bugs to <linux-trace-devel@vger.kernel.org> 185 186LICENSE 187------- 188libtraceevent is Free Software licensed under the GNU LGPL 2.1 189 190RESOURCES 191--------- 192https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 193