LIBTRACEFS(3)

NAME
libtracefs - Linux kernel trace file system library

SYNOPSIS

#include <tracefs.h>
Locations of tracing files and directories:
        char *tracefs_get_tracing_file(const char *name);
        void tracefs_put_tracing_file(char *name);
        const char *tracefs_tracing_dir(void);
Trace instances:
        struct tracefs_instance *tracefs_instance_create(const char *name);
        int tracefs_instance_destroy(struct tracefs_instance *instance);
        void tracefs_instance_free(struct tracefs_instance *instance);
        bool tracefs_instance_is_new(struct tracefs_instance *instance);
        bool tracefs_file_exists(struct tracefs_instance *instance, char *name);
        bool tracefs_dir_exists(struct tracefs_instance *instance, char *name);
        char *tracefs_instance_get_file(struct tracefs_instance *instance, const char *file);
        char *tracefs_instance_get_dir(struct tracefs_instance *instance);
        int tracefs_instance_file_open(struct tracefs_instance *instance, const char *file, int mode);
        int tracefs_instance_file_write(struct tracefs_instance *instance, const char *file, const char *str);
        char *tracefs_instance_file_read(struct tracefs_instance *instance, const char *file, int *psize);
        int tracefs_instance_file_read_number(struct tracefs_instance *instance, const char *file, long long int *res);
        const char *tracefs_instance_get_name(struct tracefs_instance *instance);
        int tracefs_instances_walk(int (*callback)(const char *, void *), void *context);
        bool tracefs_instance_exists(const char *name);
Trace events:
        char **tracefs_event_systems(const char *tracing_dir);
        char **tracefs_system_events(const char *tracing_dir, const char *system);
        int tracefs_iterate_raw_events(struct tep_handle *tep, struct tracefs_instance *instance, cpu_set_t *cpus, int cpu_size, int (*callback)(struct tep_event *, struct tep_record *, int, void *), void *callback_context);
        struct tep_handle *tracefs_local_events(const char *tracing_dir);
        struct tep_handle *tracefs_local_events_system(const char *tracing_dir, const char * const *sys_names);
        int tracefs_fill_local_events(const char *tracing_dir, struct tep_handle *tep, int *parsing_failures);
Trace helper functions:
        void tracefs_list_free(char **list);
        char **tracefs_tracers(const char *tracing_dir);
        char *tracefs_get_clock(struct tracefs_instance *instance);
        int tracefs_trace_is_on(struct tracefs_instance *instance);
        int tracefs_trace_on(struct tracefs_instance *instance);
        int tracefs_trace_off(struct tracefs_instance *instance);
        int tracefs_trace_on_get_fd(struct tracefs_instance *instance);
        int tracefs_trace_on_fd(int fd);
        int tracefs_trace_off_fd(int fd);
Writing data in the trace buffer:
        int tracefs_print_init(struct tracefs_instance *instance);
        int tracefs_printf(struct tracefs_instance *instance, const char *fmt, ...);
        int tracefs_vprintf(struct tracefs_instance *instance, const char *fmt, va_list ap);
        void tracefs_print_close(struct tracefs_instance *instance);
        int tracefs_binary_init(struct tracefs_instance *instance);
        int tracefs_binary_write(struct tracefs_instance *instance, void *data, int len);
        void tracefs_binary_close(struct tracefs_instance *instance);
Control library logs:
        int tracefs_set_loglevel(enum tep_loglevel level);

DESCRIPTION

The libtracefs(3) library provides APIs to access kernel trace file system.

FILES

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

SEE ALSO

libtraceevent(3) trace-cmd(1)

AUTHOR

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

REPORTING BUGS

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

LICENSE

libtracefs is Free Software licensed under the GNU LGPL 2.1

RESOURCES

https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/

COPYING

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

NOTES

1.  rostedt@goodmis.org
    mailto:rostedt@goodmis.org

2.  tz.stoyanov@gmail.com
    mailto:tz.stoyanov@gmail.com

3.  linux-trace-devel@vger.kernel.org
    mailto:linux-trace-devel@vger.kernel.org