1LIBTRACECMD(3)                 libtracefs Manual                LIBTRACECMD(3)
2
3
4

NAME

6       libtracecmd - trace-cmd library APIs
7

SYNOPSIS

9       #include <trace-cmd.h>
10
11       Open and close trace file:
12               struct tracecmd_input *tracecmd_open(const char *file, int flags);
13               struct tracecmd_input *tracecmd_open_fd(int fd, int flags);
14               struct tracecmd_input *tracecmd_open_head(const char *file, int flags);
15               void tracecmd_close(struct tracecmd_input *handle);
16               void tracecmd_set_private(struct tracecmd_input *handle, void *data);
17               void *tracecmd_get_private(struct tracecmd_input *handle);
18
19       Read tracing records from a trace file:
20               int tracecmd_init_data(struct tracecmd_input *handle);
21               struct tep_record *tracecmd_read_cpu_first(struct tracecmd_input *handle, int cpu);
22               struct tep_record *tracecmd_read_data(struct tracecmd_input *handle, int cpu);
23               struct tep_record *tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset, int *cpu);
24               void tracecmd_free_record(struct tep_record *record);
25               struct tep_handle *tracecmd_get_tep(struct tracecmd_input *handle);
26
27       Iterating over events in a trace file:
28               int tracecmd_iterate_events(struct tracecmd_input *handle,
29                                           cpu_set_t *cpus, int cpu_size,
30                                           int (*callback)(struct tracecmd_input *,
31                                                           struct tep_record *,
32                                                           int, void *),
33                                           void *callback_data);
34               int tracecmd_iterate_events_multi(struct tracecmd_input **handles,
35                                                 int nr_handles,
36                                                 int (*callback)(struct tracecmd_input *,
37                                                                          struct tep_record *,
38                                                                  int, void *),
39                                                 void *callback_data);
40               int tracecmd_follow_event(struct tracecmd_input *handle,
41                                         const char *system, const char *event_name,
42                                         int (*callback)(struct tracecmd_input *,
43                                                         struct tep_event *,
44                                                         struct tep_record *,
45                                                         int, void *),
46                                         void *callback_data);
47               struct tracecmd_filter *tracecmd_filter_add(struct tracecmd_input handle,
48                                                           const char *filter_str, bool neg);
49
50       Read tracing instances from a trace file:
51               int *tracecmd_buffer_instances(struct tracecmd_input *handle);
52               const char *tracecmd_buffer_instance_name(struct tracecmd_input *handle, int indx);
53               struct tracecmd_input *tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx);
54
55       Handle time stamps from a trace file:
56               unsigned long long tracecmd_get_first_ts(struct tracecmd_input *handle);
57               void tracecmd_add_ts_offset(struct tracecmd_input *handle, long long offset);
58
59       Get traceing peer information from a trace file:
60               unsigned long long tracecmd_get_traceid(struct tracecmd_input *handle);
61               int tracecmd_get_guest_cpumap(struct tracecmd_input *handle, unsigned long long trace_id, const char **name, int *vcpu_count, const int **cpu_pid);
62
63       Mapping host and guest trace files:
64               int tracecmd_map_vcpus(struct tracecmd_input **handles, int nr_handles);
65               struct tracecmd_cpu_map *tracecmd_get_cpu_map(struct tracecmd_input *handle, int cpu);
66               struct tracecmd_cpu_map *tracecmd_map_find_by_host_pid(struct tracecmd_input *handle,
67                                                             int host_pid);
68               int tracecmd_map_get_host_pid(struct tracecmd_cpu_map *map);
69               struct tracecmd_input *tracecmd_map_get_guest(struct tracecmd_cpu_map *map);
70               void tracecmd_map_set_private(struct tracecmd_cpu_map *map, void *priv);
71               void *tracecmd_map_get_private(struct tracecmd_cpu_map *map);
72
73       Control library logs:
74               int tracecmd_set_loglevel(enum tep_loglevel level);
75

DESCRIPTION

77       The libtracecmd(3) library provides APIs to read, parse and write
78       trace-cmd.dat(5) files, recorded with trace-cmd(1) application and
79       containing tracing information from ftrace, the official Linux kernel
80       tracer.
81

FILES

83           trace-cmd.h
84                   Header file to include in order to have access to the library APIs.
85           -ltracecmd
86                   Linker switch to add when building a program that uses the library.
87

SEE ALSO

89       libtraceevent(3) libtracefs(3) trace-cmd(1) trace-cmd.dat(5)
90

AUTHOR

92           Steven Rostedt <rostedt@goodmis.org[1]>
93           Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>
94

REPORTING BUGS

96       Report bugs to <linux-trace-devel@vger.kernel.org[3]>
97

LICENSE

99       libtracecmd is Free Software licensed under the GNU LGPL 2.1
100

RESOURCES

102       https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
103

COPYING

105       Copyright (C) 2020 VMware, Inc. Free use of this software is granted
106       under the terms of the GNU Public License (GPL).
107

NOTES

109        1. rostedt@goodmis.org
110           mailto:rostedt@goodmis.org
111
112        2. tz.stoyanov@gmail.com
113           mailto:tz.stoyanov@gmail.com
114
115        3. linux-trace-devel@vger.kernel.org
116           mailto:linux-trace-devel@vger.kernel.org
117
118
119
120libtracefs                        10/11/2022                    LIBTRACECMD(3)
Impressum