LIBTRACEFS(3)

πŸ’… NAME πŸ’…

hey bestie, welcome to LIBTRACEFS(3) β€” the libtracefs manual page, and it's giving "ftrace options explained by your favorite Unix-obsessed group chat" energy ✨

tracefs_options β€” ftrace options that can be controlled using the tracefs library πŸ’–


🌸 SYNOPSIS 🌸

#include <tracefs.h>

enum tracefs_option_id {
        TRACEFS_OPTION_INVALID,
        TRACEFS_OPTION_ANNOTATE,
        TRACEFS_OPTION_BIN,
        TRACEFS_OPTION_BLK_CGNAME,
        TRACEFS_OPTION_BLK_CGROUP,
        TRACEFS_OPTION_BLK_CLASSIC,
        TRACEFS_OPTION_BLOCK,
        TRACEFS_OPTION_CONTEXT_INFO,
        TRACEFS_OPTION_DISABLE_ON_FREE,
        TRACEFS_OPTION_DISPLAY_GRAPH,
        TRACEFS_OPTION_EVENT_FORK,
        TRACEFS_OPTION_FGRAPH_ABSTIME,
        TRACEFS_OPTION_FGRAPH_CPU,
        TRACEFS_OPTION_FGRAPH_DURATION,
        TRACEFS_OPTION_FGRAPH_IRQS,
        TRACEFS_OPTION_FGRAPH_OVERHEAD,
        TRACEFS_OPTION_FGRAPH_OVERRUN,
        TRACEFS_OPTION_FGRAPH_PROC,
        TRACEFS_OPTION_FGRAPH_TAIL,
        TRACEFS_OPTION_FUNC_STACKTRACE,
        TRACEFS_OPTION_FUNCTION_FORK,
        TRACEFS_OPTION_FUNCTION_TRACE,
        TRACEFS_OPTION_GRAPH_TIME,
        TRACEFS_OPTION_HEX,
        TRACEFS_OPTION_IRQ_INFO,
        TRACEFS_OPTION_LATENCY_FORMAT,
        TRACEFS_OPTION_MARKERS,
        TRACEFS_OPTION_OVERWRITE,
        TRACEFS_OPTION_PAUSE_ON_TRACE,
        TRACEFS_OPTION_PRINTK_MSG_ONLY,
        TRACEFS_OPTION_PRINT_PARENT,
        TRACEFS_OPTION_RAW,
        TRACEFS_OPTION_RECORD_CMD,
        TRACEFS_OPTION_RECORD_TGID,
        TRACEFS_OPTION_SLEEP_TIME,
        TRACEFS_OPTION_STACKTRACE,
        TRACEFS_OPTION_SYM_ADDR,
        TRACEFS_OPTION_SYM_OFFSET,
        TRACEFS_OPTION_SYM_USEROBJ,
        TRACEFS_OPTION_TRACE_PRINTK,
        TRACEFS_OPTION_USERSTACKTRACE,
        TRACEFS_OPTION_VERBOSE,
};

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this enum is basically the whole roster of ftrace options that can be manipulated using the tracefs library πŸ‘‘

want the deep lore on any specific option? it lives in Documentation/trace/ftrace.rst from the Linux kernel tree, in the trace_options section. no cap πŸ“š

heads up, bestie: some ftrace options cannot be manipulated by this library, because they're intended for internal, debug purposes. these options control the tracers or the trace output. every option has two states β€” on and off β€” and the default state is different for each of them πŸ’…

🌈 Common options for all tracers 🌈

  • TRACEFS_OPTION_INVALID β€” not a valid ftrace option; it's used by the API to indicate an error.
  • TRACEFS_OPTION_ANNOTATE β€” display when a new CPU buffer started.
  • TRACEFS_OPTION_BIN β€” display the formats in raw binary.
  • TRACEFS_OPTION_CONTEXT_INFO β€” show only the event data. hides the comm, PID, timestamp, CPU, and other useful data.
  • TRACEFS_OPTION_BLOCK β€” when set, reading trace_pipe will not block when polled.
  • TRACEFS_OPTION_DISABLE_ON_FREE β€” when the free_buffer is closed, tracing will stop.
  • TRACEFS_OPTION_DISPLAY_GRAPH β€” when set, the latency tracers will use function graph tracing instead of function tracing.
  • TRACEFS_OPTION_EVENT_FORK β€” when set, tasks with PIDs listed in set_event_pid will have the PIDs of their children added to set_event_pid when those tasks fork.
  • TRACEFS_OPTION_FUNCTION_FORK β€” when set, tasks with PIDs listed in set_ftrace_pid will have the PIDs of their children added to set_ftrace_pid when those tasks fork.
  • TRACEFS_OPTION_FUNCTION_TRACE β€” when enabled, the latency tracers will trace functions.
  • TRACEFS_OPTION_HEX β€” display numbers in a hexadecimal format.
  • TRACEFS_OPTION_IRQ_INFO β€” display the interrupt, preempt count, need resched data.
  • TRACEFS_OPTION_LATENCY_FORMAT β€” display additional information about the latency.
  • TRACEFS_OPTION_MARKERS β€” when set, the trace_marker is enabled β€” writable (only by root).
  • TRACEFS_OPTION_OVERWRITE β€” controls what happens when the trace buffer is full. if set, the oldest events are discarded and overwritten. if disabled, then the newest events are discarded.
  • TRACEFS_OPTION_PAUSE_ON_TRACE β€” when set, opening the trace file for read will pause writing to the ring buffer. when the file is closed, tracing will be enabled again.
  • TRACEFS_OPTION_PRINTK_MSG_ONLY β€” when set, trace_printk()s will only show the format and not their parameters.
  • TRACEFS_OPTION_PRINT_PARENT β€” on function traces, display the calling (parent) function as well as the function being traced.
  • TRACEFS_OPTION_RAW β€” display raw numbers.
  • TRACEFS_OPTION_RECORD_CMD β€” save a mapping with a pid and corresponding command.
  • TRACEFS_OPTION_RECORD_TGID β€” save a mapping with a pid and corresponding Thread Group IDs.
  • TRACEFS_OPTION_STACKTRACE β€” record a stack trace after any trace event.
  • TRACEFS_OPTION_SYM_ADDR β€” display the function address as well as the function name.
  • TRACEFS_OPTION_SYM_OFFSET β€” display not only the function name, but also the offset in the function.
  • TRACEFS_OPTION_SYM_USEROBJ β€” when TRACEFS_OPTION_USERSTACKTRACE is set, look up which object the address belongs to, and print the object and a relative address.
  • TRACEFS_OPTION_TRACE_PRINTK β€” disable trace_printk() from writing into the buffer.
  • TRACEFS_OPTION_USERSTACKTRACE β€” records a stack trace of the current user space thread after each trace event.
  • TRACEFS_OPTION_VERBOSE β€” when TRACEFS_OPTION_LATENCY_FORMAT is enabled, print more detailed information.

🧚 Options, specific to function tracer 🧚

  • TRACEFS_OPTION_FUNC_STACKTRACE β€” record a stack trace after every function.

πŸŽ€ Options, specific to function_graph tracer πŸŽ€

  • TRACEFS_OPTION_FGRAPH_ABSTIME β€” display the timestamp at each line.
  • TRACEFS_OPTION_FGRAPH_CPU β€” display the CPU number of the CPU where the trace occurred.
  • TRACEFS_OPTION_FGRAPH_DURATION β€” display the duration of the amount of time at the end of each function, in microseconds.
  • TRACEFS_OPTION_FGRAPH_IRQS β€” trace functions that happen inside an interrupt.
  • TRACEFS_OPTION_FGRAPH_OVERHEAD β€” display a marker if a function takes longer than a certain amount of time.
  • TRACEFS_OPTION_FGRAPH_OVERRUN β€” display "overrun" of the call graph, in the case of functions missed due to big callstack.
  • TRACEFS_OPTION_FGRAPH_PROC β€” display the command of each process at every line.
  • TRACEFS_OPTION_FGRAPH_TAIL β€” display the function name on its return.
  • TRACEFS_OPTION_SLEEP_TIME β€” account time the task has been scheduled out as part of the function call.
  • TRACEFS_OPTION_GRAPH_TIME β€” display the time to call nested functions, if function profiler is enabled.

πŸ“ Options, specific to blk tracer πŸ“

  • TRACEFS_OPTION_BLK_CGNAME β€” listed here under the blk tracer options; the source gives no extra description for this one.
  • TRACEFS_OPTION_BLK_CGROUP β€” also listed here under the blk tracer options; no extra description in the source either.
  • TRACEFS_OPTION_BLK_CLASSIC β€” display a more minimalistic output.

🌟 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 πŸ‘€


🫢 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 πŸ”—


πŸ’– COPYING πŸ’–

Copyright (C) 2021 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

okay that's the whole page, bestie β€” xoxo, your libtracefs hype girl πŸ’– this was libtracefs 1.8.4, dated 10/21/2026. periodt πŸ¦‹

πŸ“¦ where this page comes from