1libtracecmd(3) 2============= 3 4NAME 5---- 6libtracecmd - trace-cmd library APIs 7 8SYNOPSIS 9-------- 10[verse] 11-- 12*#include <trace-cmd.h>* 13 14Open and close trace file: 15 struct tracecmd_input pass:[*]*tracecmd_open*(const char pass:[*]_file_, int _flags_); 16 struct tracecmd_input pass:[*]*tracecmd_open_fd*(int _fd_, int _flags_); 17 struct tracecmd_input pass:[*]*tracecmd_open_head*(const char pass:[*]_file_, int _flags_); 18 void *tracecmd_close*(struct tracecmd_input pass:[*]_handle_); 19 void *tracecmd_set_private*(struct tracecmd_input pass:[*]_handle_, void pass:[*]_data_); 20 void pass:[*]*tracecmd_get_private*(struct tracecmd_input pass:[*]_handle_); 21 22Read tracing records from a trace file: 23 int *tracecmd_init_data*(struct tracecmd_input pass:[*]_handle_); 24 struct tep_record pass:[*]*tracecmd_read_cpu_first*(struct tracecmd_input pass:[*]_handle_, int _cpu_); 25 struct tep_record pass:[*]*tracecmd_read_data*(struct tracecmd_input pass:[*]_handle_, int _cpu_); 26 struct tep_record pass:[*]*tracecmd_read_at*(struct tracecmd_input pass:[*]_handle_, unsigned long long _offset_, int pass:[*]_cpu_); 27 void *tracecmd_free_record*(struct tep_record pass:[*]_record_); 28 struct tep_handle pass:[*]*tracecmd_get_tep*(struct tracecmd_input pass:[*]_handle_); 29 30Iterating over events in a trace file: 31 int *tracecmd_iterate_events*(struct tracecmd_input pass:[*]_handle_, 32 cpu_set_t pass:[*]_cpus_, int _cpu_size_, 33 int (pass:[*]_callback_)(struct tracecmd_input pass:[*], 34 struct tep_record pass:[*], 35 int, void pass:[*]), 36 void pass:[*]_callback_data_); 37 int *tracecmd_iterate_events_multi*(struct tracecmd_input pass:[**]_handles_, 38 int _nr_handles_, 39 int (pass:[*]_callback_)(struct tracecmd_input pass:[*], 40 struct tep_record pass:[*], 41 int, void pass:[*]), 42 void pass:[*]_callback_data_); 43 int *tracecmd_iterate_events_reverse*(struct tracecmd_input pass:[*]_handle_, 44 cpu_set_t pass:[*]_cpus_, int _cpu_size_, 45 int (pass:[*]_callback_)(struct tracecmd_input pass:[*], 46 struct tep_record pass:[*], 47 int, void pass:[*]), 48 void pass:[*]_callback_data_, bool _cont_); 49 int *tracecmd_follow_event*(struct tracecmd_input pass:[*]_handle_, 50 const char pass:[*]_system_, const char pass:[*]_event_name_, 51 int (pass:[*]_callback_)(struct tracecmd_input pass:[*], 52 struct tep_event pass:[*], 53 struct tep_record pass:[*], 54 int, void pass:[*]), 55 void pass:[*]_callback_data_); 56 int *tracecmd_follow_missed_events*(struct tracecmd_input pass:[*]_handle_, 57 int (pass:[*]_callback_)(struct tracecmd_input pass:[*], 58 struct tep_event pass:[*], 59 struct tep_record pass:[*], 60 int, void pass:[*]), 61 void pass:[*]_callback_data_); 62 struct tracecmd_filter pass:[*]*tracecmd_filter_add*(struct tracecmd_input *_handle_, 63 const char pass:[*]_filter_str_, bool _neg_); 64 int *tracecmd_iterate_reset*(struct tracecmd_input pass:[*]_handle_); 65 66Read tracing instances from a trace file: 67 int *tracecmd_buffer_instances*(struct tracecmd_input pass:[*]_handle_); 68 const char pass:[*]*tracecmd_buffer_instance_name*(struct tracecmd_input pass:[*]_handle_, int _indx_); 69 struct tracecmd_input pass:[*]*tracecmd_buffer_instance_handle*(struct tracecmd_input pass:[*]_handle_, int _indx_); 70 71Handle time stamps from a trace file: 72 unsigned long long *tracecmd_get_first_ts*(struct tracecmd_input pass:[*]_handle_); 73 void *tracecmd_add_ts_offset*(struct tracecmd_input pass:[*]_handle_, long long _offset_); 74 int *tracecmd_get_tsc2nsec*(struct tracecmd_input pass:[*]_handle_, int pass:[*]_mult_, int pass[*]_shift_, unsigned long long pass:[*]_offset_); 75 76Get traceing peer information from a trace file: 77 unsigned long long *tracecmd_get_traceid*(struct tracecmd_input pass:[*]_handle_); 78 int *tracecmd_get_guest_cpumap*(struct tracecmd_input pass:[*]_handle_, unsigned long long _trace_id_, const char pass:[*]pass:[*]_name_, int pass:[*]_vcpu_count_, const int pass:[*]pass:[*]_cpu_pid_); 79 80Mapping host and guest trace files: 81 int *tracecmd_map_vcpus*(struct tracecmd_input pass:[**]handles, int nr_handles); 82 struct tracecmd_cpu_map pass:[*]*tracecmd_get_cpu_map*(struct tracecmd_input pass:[*]handle, int cpu); 83 struct tracecmd_cpu_map pass:[*]*tracecmd_map_find_by_host_pid*(struct tracecmd_input pass:[*]handle, 84 int host_pid); 85 int *tracecmd_map_get_host_pid*(struct tracecmd_cpu_map pass:[*]map); 86 struct tracecmd_input pass:[*]*tracecmd_map_get_guest*(struct tracecmd_cpu_map pass:[*]map); 87 void *tracecmd_map_set_private*(struct tracecmd_cpu_map pass:[*]map, void pass:[*]priv); 88 void pass:[*]*tracecmd_map_get_private*(struct tracecmd_cpu_map pass:[*]map); 89 90Control library logs: 91 int *tracecmd_set_loglevel*(enum tep_loglevel _level_); 92-- 93 94DESCRIPTION 95----------- 96The libtracecmd(3) library provides APIs to read, parse and write 97_trace-cmd.dat(5)_ files, recorded with _trace-cmd(1)_ application and containing 98tracing information from ftrace, the official Linux kernel tracer. 99 100FILES 101----- 102[verse] 103-- 104*trace-cmd.h* 105 Header file to include in order to have access to the library APIs. 106*-ltracecmd* 107 Linker switch to add when building a program that uses the library. 108-- 109 110SEE ALSO 111-------- 112*libtraceevent(3)* 113*libtracefs(3)* 114*trace-cmd(1)* 115*trace-cmd.dat(5)* 116 117AUTHOR 118------ 119[verse] 120-- 121*Steven Rostedt* <rostedt@goodmis.org> 122*Tzvetomir Stoyanov* <tz.stoyanov@gmail.com> 123-- 124REPORTING BUGS 125-------------- 126Report bugs to <linux-trace-devel@vger.kernel.org> 127 128LICENSE 129------- 130libtracecmd is Free Software licensed under the GNU LGPL 2.1 131 132RESOURCES 133--------- 134https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/ 135 136COPYING 137------- 138Copyright \(C) 2020 VMware, Inc. Free use of this software is granted under 139the terms of the GNU Public License (GPL). 140