18c2ecf20Sopenharmony_cilibtraceevent(3) 28c2ecf20Sopenharmony_ci================ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ciNAME 58c2ecf20Sopenharmony_ci---- 68c2ecf20Sopenharmony_cilibtraceevent - Linux kernel trace event library 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciSYNOPSIS 98c2ecf20Sopenharmony_ci-------- 108c2ecf20Sopenharmony_ci[verse] 118c2ecf20Sopenharmony_ci-- 128c2ecf20Sopenharmony_ci*#include <event-parse.h>* 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciManagement of tep handler data structure and access of its members: 158c2ecf20Sopenharmony_ci struct tep_handle pass:[*]*tep_alloc*(void); 168c2ecf20Sopenharmony_ci void *tep_free*(struct tep_handle pass:[*]_tep_); 178c2ecf20Sopenharmony_ci void *tep_ref*(struct tep_handle pass:[*]_tep_); 188c2ecf20Sopenharmony_ci void *tep_unref*(struct tep_handle pass:[*]_tep_); 198c2ecf20Sopenharmony_ci int *tep_get_ref*(struct tep_handle pass:[*]_tep_); 208c2ecf20Sopenharmony_ci void *tep_set_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_); 218c2ecf20Sopenharmony_ci void *tep_clear_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flag_); 228c2ecf20Sopenharmony_ci bool *tep_test_flag*(struct tep_handle pass:[*]_tep_, enum tep_flag _flags_); 238c2ecf20Sopenharmony_ci int *tep_get_cpus*(struct tep_handle pass:[*]_tep_); 248c2ecf20Sopenharmony_ci void *tep_set_cpus*(struct tep_handle pass:[*]_tep_, int _cpus_); 258c2ecf20Sopenharmony_ci int *tep_get_long_size*(strucqt tep_handle pass:[*]_tep_); 268c2ecf20Sopenharmony_ci void *tep_set_long_size*(struct tep_handle pass:[*]_tep_, int _long_size_); 278c2ecf20Sopenharmony_ci int *tep_get_page_size*(struct tep_handle pass:[*]_tep_); 288c2ecf20Sopenharmony_ci void *tep_set_page_size*(struct tep_handle pass:[*]_tep_, int _page_size_); 298c2ecf20Sopenharmony_ci int *tep_get_header_page_size*(struct tep_handle pass:[*]_tep_); 308c2ecf20Sopenharmony_ci int *tep_get_header_timestamp_size*(struct tep_handle pass:[*]_tep_); 318c2ecf20Sopenharmony_ci bool *tep_is_old_format*(struct tep_handle pass:[*]_tep_); 328c2ecf20Sopenharmony_ci int *tep_strerror*(struct tep_handle pass:[*]_tep_, enum tep_errno _errnum_, char pass:[*]_buf_, size_t _buflen_); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciRegister / unregister APIs: 358c2ecf20Sopenharmony_ci int *tep_register_function*(struct tep_handle pass:[*]_tep_, char pass:[*]_name_, unsigned long long _addr_, char pass:[*]_mod_); 368c2ecf20Sopenharmony_ci 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_); 378c2ecf20Sopenharmony_ci 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_); 388c2ecf20Sopenharmony_ci int *tep_register_print_string*(struct tep_handle pass:[*]_tep_, const char pass:[*]_fmt_, unsigned long long _addr_); 398c2ecf20Sopenharmony_ci int *tep_register_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, enum tep_func_arg_type _ret_type_, char pass:[*]_name_, _..._); 408c2ecf20Sopenharmony_ci int *tep_unregister_print_function*(struct tep_handle pass:[*]_tep_, tep_func_handler _func_, char pass:[*]_name_); 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciPlugins management: 438c2ecf20Sopenharmony_ci struct tep_plugin_list pass:[*]*tep_load_plugins*(struct tep_handle pass:[*]_tep_); 448c2ecf20Sopenharmony_ci void *tep_unload_plugins*(struct tep_plugin_list pass:[*]_plugin_list_, struct tep_handle pass:[*]_tep_); 458c2ecf20Sopenharmony_ci char pass:[*]pass:[*]*tep_plugin_list_options*(void); 468c2ecf20Sopenharmony_ci void *tep_plugin_free_options_list*(char pass:[*]pass:[*]_list_); 478c2ecf20Sopenharmony_ci int *tep_plugin_add_options*(const char pass:[*]_name_, struct tep_plugin_option pass:[*]_options_); 488c2ecf20Sopenharmony_ci void *tep_plugin_remove_options*(struct tep_plugin_option pass:[*]_options_); 498c2ecf20Sopenharmony_ci void *tep_print_plugins*(struct trace_seq pass:[*]_s_, const char pass:[*]_prefix_, const char pass:[*]_suffix_, const struct tep_plugin_list pass:[*]_list_); 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ciEvent related APIs: 528c2ecf20Sopenharmony_ci struct tep_event pass:[*]*tep_get_event*(struct tep_handle pass:[*]_tep_, int _index_); 538c2ecf20Sopenharmony_ci struct tep_event pass:[*]*tep_get_first_event*(struct tep_handle pass:[*]_tep_); 548c2ecf20Sopenharmony_ci int *tep_get_events_count*(struct tep_handle pass:[*]_tep_); 558c2ecf20Sopenharmony_ci struct tep_event pass:[*]pass:[*]*tep_list_events*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_); 568c2ecf20Sopenharmony_ci struct tep_event pass:[*]pass:[*]*tep_list_events_copy*(struct tep_handle pass:[*]_tep_, enum tep_event_sort_type _sort_type_); 578c2ecf20Sopenharmony_ci void *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seq pass:[*]_s_, struct tep_record pass:[*]_record_, const char pass:[*]_fmt_, _..._); 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciEvent finding: 608c2ecf20Sopenharmony_ci struct tep_event pass:[*]*tep_find_event*(struct tep_handle pass:[*]_tep_, int _id_); 618c2ecf20Sopenharmony_ci struct tep_event pass:[*]*tep_find_event_by_name*(struct tep_handle pass:[*]_tep_, const char pass:[*]_sys_, const char pass:[*]_name_); 628c2ecf20Sopenharmony_ci struct tep_event pass:[*]*tep_find_event_by_record*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_record_); 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciParsing of event files: 658c2ecf20Sopenharmony_ci int *tep_parse_header_page*(struct tep_handle pass:[*]_tep_, char pass:[*]_buf_, unsigned long _size_, int _long_size_); 668c2ecf20Sopenharmony_ci enum tep_errno *tep_parse_event*(struct tep_handle pass:[*]_tep_, const char pass:[*]_buf_, unsigned long _size_, const char pass:[*]_sys_); 678c2ecf20Sopenharmony_ci 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_); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ciAPIs related to fields from event's format files: 708c2ecf20Sopenharmony_ci struct tep_format_field pass:[*]pass:[*]*tep_event_common_fields*(struct tep_event pass:[*]_event_); 718c2ecf20Sopenharmony_ci struct tep_format_field pass:[*]pass:[*]*tep_event_fields*(struct tep_event pass:[*]_event_); 728c2ecf20Sopenharmony_ci 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_); 738c2ecf20Sopenharmony_ci 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_); 748c2ecf20Sopenharmony_ci 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_); 758c2ecf20Sopenharmony_ci 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_); 768c2ecf20Sopenharmony_ci int *tep_read_number_field*(struct tep_format_field pass:[*]_field_, const void pass:[*]_data_, unsigned long long pass:[*]_value_); 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ciEvent fields printing: 798c2ecf20Sopenharmony_ci void *tep_print_field*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, struct tep_format_field pass:[*]_field_); 808c2ecf20Sopenharmony_ci void *tep_print_fields*(struct trace_seq pass:[*]_s_, void pass:[*]_data_, int _size_, struct tep_event pass:[*]_event_); 818c2ecf20Sopenharmony_ci 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_); 828c2ecf20Sopenharmony_ci 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_); 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ciEvent fields finding: 858c2ecf20Sopenharmony_ci struct tep_format_field pass:[*]*tep_find_common_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); 868c2ecf20Sopenharmony_ci struct tep_format_field pass:[*]*tep_find_field*(struct tep_event_ormat pass:[*]_event_, const char pass:[*]_name_); 878c2ecf20Sopenharmony_ci struct tep_format_field pass:[*]*tep_find_any_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ciFunctions resolver: 908c2ecf20Sopenharmony_ci int *tep_set_function_resolver*(struct tep_handle pass:[*]_tep_, tep_func_resolver_t pass:[*]_func_, void pass:[*]_priv_); 918c2ecf20Sopenharmony_ci void *tep_reset_function_resolver*(struct tep_handle pass:[*]_tep_); 928c2ecf20Sopenharmony_ci const char pass:[*]*tep_find_function*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_); 938c2ecf20Sopenharmony_ci unsigned long long *tep_find_function_address*(struct tep_handle pass:[*]_tep_, unsigned long long _addr_); 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ciFilter management: 968c2ecf20Sopenharmony_ci struct tep_event_filter pass:[*]*tep_filter_alloc*(struct tep_handle pass:[*]_tep_); 978c2ecf20Sopenharmony_ci enum tep_errno *tep_filter_add_filter_str*(struct tep_event_filter pass:[*]_filter_, const char pass:[*]_filter_str_); 988c2ecf20Sopenharmony_ci enum tep_errno *tep_filter_match*(struct tep_event_filter pass:[*]_filter_, struct tep_record pass:[*]_record_); 998c2ecf20Sopenharmony_ci int *tep_filter_strerror*(struct tep_event_filter pass:[*]_filter_, enum tep_errno _err_, char pass:[*]buf, size_t _buflen_); 1008c2ecf20Sopenharmony_ci int *tep_event_filtered*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 1018c2ecf20Sopenharmony_ci void *tep_filter_reset*(struct tep_event_filter pass:[*]_filter_); 1028c2ecf20Sopenharmony_ci void *tep_filter_free*(struct tep_event_filter pass:[*]_filter_); 1038c2ecf20Sopenharmony_ci char pass:[*]*tep_filter_make_string*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 1048c2ecf20Sopenharmony_ci int *tep_filter_remove_event*(struct tep_event_filter pass:[*]_filter_, int _event_id_); 1058c2ecf20Sopenharmony_ci int *tep_filter_copy*(struct tep_event_filter pass:[*]_dest_, struct tep_event_filter pass:[*]_source_); 1068c2ecf20Sopenharmony_ci int *tep_filter_compare*(struct tep_event_filter pass:[*]_filter1_, struct tep_event_filter pass:[*]_filter2_); 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciParsing various data from the records: 1098c2ecf20Sopenharmony_ci int *tep_data_type*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 1108c2ecf20Sopenharmony_ci int *tep_data_pid*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 1118c2ecf20Sopenharmony_ci int *tep_data_preempt_count*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 1128c2ecf20Sopenharmony_ci int *tep_data_flags*(struct tep_handle pass:[*]_tep_, struct tep_record pass:[*]_rec_); 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ciCommand and task related APIs: 1158c2ecf20Sopenharmony_ci const char pass:[*]*tep_data_comm_from_pid*(struct tep_handle pass:[*]_tep_, int _pid_); 1168c2ecf20Sopenharmony_ci struct cmdline pass:[*]*tep_data_pid_from_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, struct cmdline pass:[*]_next_); 1178c2ecf20Sopenharmony_ci int *tep_register_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_); 1188c2ecf20Sopenharmony_ci int *tep_override_comm*(struct tep_handle pass:[*]_tep_, const char pass:[*]_comm_, int _pid_); 1198c2ecf20Sopenharmony_ci bool *tep_is_pid_registered*(struct tep_handle pass:[*]_tep_, int _pid_); 1208c2ecf20Sopenharmony_ci int *tep_cmdline_pid*(struct tep_handle pass:[*]_tep_, struct cmdline pass:[*]_cmdline_); 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ciEndian related APIs: 1238c2ecf20Sopenharmony_ci int *tep_is_bigendian*(void); 1248c2ecf20Sopenharmony_ci unsigned long long *tep_read_number*(struct tep_handle pass:[*]_tep_, const void pass:[*]_ptr_, int _size_); 1258c2ecf20Sopenharmony_ci bool *tep_is_file_bigendian*(struct tep_handle pass:[*]_tep_); 1268c2ecf20Sopenharmony_ci void *tep_set_file_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_); 1278c2ecf20Sopenharmony_ci bool *tep_is_local_bigendian*(struct tep_handle pass:[*]_tep_); 1288c2ecf20Sopenharmony_ci void *tep_set_local_bigendian*(struct tep_handle pass:[*]_tep_, enum tep_endian _endian_); 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ciTrace sequences: 1318c2ecf20Sopenharmony_ci*#include <trace-seq.h>* 1328c2ecf20Sopenharmony_ci void *trace_seq_init*(struct trace_seq pass:[*]_s_); 1338c2ecf20Sopenharmony_ci void *trace_seq_reset*(struct trace_seq pass:[*]_s_); 1348c2ecf20Sopenharmony_ci void *trace_seq_destroy*(struct trace_seq pass:[*]_s_); 1358c2ecf20Sopenharmony_ci int *trace_seq_printf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, ...); 1368c2ecf20Sopenharmony_ci int *trace_seq_vprintf*(struct trace_seq pass:[*]_s_, const char pass:[*]_fmt_, va_list _args_); 1378c2ecf20Sopenharmony_ci int *trace_seq_puts*(struct trace_seq pass:[*]_s_, const char pass:[*]_str_); 1388c2ecf20Sopenharmony_ci int *trace_seq_putc*(struct trace_seq pass:[*]_s_, unsigned char _c_); 1398c2ecf20Sopenharmony_ci void *trace_seq_terminate*(struct trace_seq pass:[*]_s_); 1408c2ecf20Sopenharmony_ci int *trace_seq_do_fprintf*(struct trace_seq pass:[*]_s_, FILE pass:[*]_fp_); 1418c2ecf20Sopenharmony_ci int *trace_seq_do_printf*(struct trace_seq pass:[*]_s_); 1428c2ecf20Sopenharmony_ci-- 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ciDESCRIPTION 1458c2ecf20Sopenharmony_ci----------- 1468c2ecf20Sopenharmony_ciThe libtraceevent(3) library provides APIs to access kernel tracepoint events, 1478c2ecf20Sopenharmony_cilocated in the tracefs file system under the events directory. 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ciENVIRONMENT 1508c2ecf20Sopenharmony_ci----------- 1518c2ecf20Sopenharmony_ci[verse] 1528c2ecf20Sopenharmony_ci-- 1538c2ecf20Sopenharmony_ciTRACEEVENT_PLUGIN_DIR 1548c2ecf20Sopenharmony_ci Additional plugin directory. All shared object files, located in this directory will be loaded as traceevent plugins. 1558c2ecf20Sopenharmony_ci-- 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ciFILES 1588c2ecf20Sopenharmony_ci----- 1598c2ecf20Sopenharmony_ci[verse] 1608c2ecf20Sopenharmony_ci-- 1618c2ecf20Sopenharmony_ci*event-parse.h* 1628c2ecf20Sopenharmony_ci Header file to include in order to have access to the library APIs. 1638c2ecf20Sopenharmony_ci*trace-seq.h* 1648c2ecf20Sopenharmony_ci Header file to include in order to have access to trace sequences related APIs. 1658c2ecf20Sopenharmony_ci Trace sequences are used to allow a function to call several other functions 1668c2ecf20Sopenharmony_ci to create a string of data to use. 1678c2ecf20Sopenharmony_ci*-ltraceevent* 1688c2ecf20Sopenharmony_ci Linker switch to add when building a program that uses the library. 1698c2ecf20Sopenharmony_ci-- 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ciSEE ALSO 1728c2ecf20Sopenharmony_ci-------- 1738c2ecf20Sopenharmony_ci_trace-cmd(1)_ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ciAUTHOR 1768c2ecf20Sopenharmony_ci------ 1778c2ecf20Sopenharmony_ci[verse] 1788c2ecf20Sopenharmony_ci-- 1798c2ecf20Sopenharmony_ci*Steven Rostedt* <rostedt@goodmis.org>, author of *libtraceevent*. 1808c2ecf20Sopenharmony_ci*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com>, author of this man page. 1818c2ecf20Sopenharmony_ci-- 1828c2ecf20Sopenharmony_ciREPORTING BUGS 1838c2ecf20Sopenharmony_ci-------------- 1848c2ecf20Sopenharmony_ciReport bugs to <linux-trace-devel@vger.kernel.org> 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ciLICENSE 1878c2ecf20Sopenharmony_ci------- 1888c2ecf20Sopenharmony_cilibtraceevent is Free Software licensed under the GNU LGPL 2.1 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ciRESOURCES 1918c2ecf20Sopenharmony_ci--------- 1928c2ecf20Sopenharmony_cihttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 193