LIBTRACECMD(3) libtracefs Manual LIBTRACECMD(3)

libtracecmd - trace-cmd library APIs

#include <trace-cmd.h>
Open and close trace file:

struct tracecmd_input *tracecmd_open(const char *file, int flags);
struct tracecmd_input *tracecmd_open_fd(int fd, int flags);
struct tracecmd_input *tracecmd_open_head(const char *file, int flags);
void tracecmd_close(struct tracecmd_input *handle); Read tracing records from a trace file:
int tracecmd_init_data(struct tracecmd_input *handle);
struct tep_record *tracecmd_read_cpu_first(struct tracecmd_input *handle, int cpu);
struct tep_record *tracecmd_read_data(struct tracecmd_input *handle, int cpu);
struct tep_record *tracecmd_read_at(struct tracecmd_input *handle, unsigned long long offset, int *cpu);
void tracecmd_free_record(struct tep_record *record);
struct tep_handle *tracecmd_get_tep(struct tracecmd_input *handle); Read tracing instances from a trace file:
int tracecmd_buffer_instances(struct tracecmd_input *handle);
const char *tracecmd_buffer_instance_name(struct tracecmd_input *handle, int indx);
struct tracecmd_input *tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx); Get traceing peer information from a trace file:
unsigned long long tracecmd_get_traceid(struct tracecmd_input *handle);
int tracecmd_get_guest_cpumap(struct tracecmd_input *handle, unsigned long long trace_id, const char **name, int *vcpu_count, const int **cpu_pid);

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


Header file to include in order to have access to the library APIs. -ltracecmd
Linker switch to add when building a program that uses the library.

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

Steven Rostedt <[1]>
Tzvetomir Stoyanov <[2]>

Report bugs to <[3]>

libtracecmd is Free Software licensed under the GNU LGPL 2.1

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

11/11/2021 libtracefs