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               int tracecmd_follow_missed_events(struct tracecmd_input *handle,
48                                                  int (*callback)(struct tracecmd_input *,
49                                                                  struct tep_event *,
50                                                                  struct tep_record *,
51                                                                  int, void *),
52                                                  void *callback_data);
53               struct tracecmd_filter *tracecmd_filter_add(struct tracecmd_input handle,
54                                                           const char *filter_str, bool neg);
55
56       Read tracing instances from a trace file:
57               int *tracecmd_buffer_instances(struct tracecmd_input *handle);
58               const char *tracecmd_buffer_instance_name(struct tracecmd_input *handle, int indx);
59               struct tracecmd_input *tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx);
60
61       Handle time stamps from a trace file:
62               unsigned long long tracecmd_get_first_ts(struct tracecmd_input *handle);
63               void tracecmd_add_ts_offset(struct tracecmd_input *handle, long long offset);
64
65       Get traceing peer information from a trace file:
66               unsigned long long tracecmd_get_traceid(struct tracecmd_input *handle);
67               int tracecmd_get_guest_cpumap(struct tracecmd_input *handle, unsigned long long trace_id, const char **name, int *vcpu_count, const int **cpu_pid);
68
69       Mapping host and guest trace files:
70               int tracecmd_map_vcpus(struct tracecmd_input **handles, int nr_handles);
71               struct tracecmd_cpu_map *tracecmd_get_cpu_map(struct tracecmd_input *handle, int cpu);
72               struct tracecmd_cpu_map *tracecmd_map_find_by_host_pid(struct tracecmd_input *handle,
73                                                             int host_pid);
74               int tracecmd_map_get_host_pid(struct tracecmd_cpu_map *map);
75               struct tracecmd_input *tracecmd_map_get_guest(struct tracecmd_cpu_map *map);
76               void tracecmd_map_set_private(struct tracecmd_cpu_map *map, void *priv);
77               void *tracecmd_map_get_private(struct tracecmd_cpu_map *map);
78
79       Control library logs:
80               int tracecmd_set_loglevel(enum tep_loglevel level);
81

DESCRIPTION

83       The libtracecmd(3) library provides APIs to read, parse and write
84       trace-cmd.dat(5) files, recorded with trace-cmd(1) application and
85       containing tracing information from ftrace, the official Linux kernel
86       tracer.
87

FILES

89           trace-cmd.h
90                   Header file to include in order to have access to the library APIs.
91           -ltracecmd
92                   Linker switch to add when building a program that uses the library.
93

SEE ALSO

95       libtraceevent(3) libtracefs(3) trace-cmd(1) trace-cmd.dat(5)
96

AUTHOR

98           Steven Rostedt <rostedt@goodmis.org[1]>
99           Tzvetomir Stoyanov <tz.stoyanov@gmail.com[2]>
100

REPORTING BUGS

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

LICENSE

105       libtracecmd is Free Software licensed under the GNU LGPL 2.1
106

RESOURCES

108       https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
109

COPYING

111       Copyright (C) 2020 VMware, Inc. Free use of this software is granted
112       under the terms of the GNU Public License (GPL).
113

NOTES

115        1. rostedt@goodmis.org
116           mailto:rostedt@goodmis.org
117
118        2. tz.stoyanov@gmail.com
119           mailto:tz.stoyanov@gmail.com
120
121        3. linux-trace-devel@vger.kernel.org
122           mailto:linux-trace-devel@vger.kernel.org
123
124
125
126libtracefs                        07/20/2023                    LIBTRACECMD(3)
Impressum