Questions tagged [ftrace]

Ftrace is an internal tracing utility built directly into the Linux kernel. It can be used for debugging or analyzing latencies and performance issues that take place outside of user-space.

Ftrace is an internal tracer designed to help out developers and designers of systems to find what is going on inside the Linux kernel. Ftrace was derived from two preceding tools: the "latency tracer" by Ingo Molnar and the "logdev" utility by Steven Rostedt. It can be used for debugging or analyzing latencies and performance issues that take place outside of user-space.

Ftrace also includes a plugin infrastructure that allows for other types of tracing. Tracers available in ftrace through plugins allow tracing such events as:

  • context switches
  • the time it takes for a high priority task to run after it was woken up
  • the amount of time for which interrupts are disabled

123 questions
28
votes
1 answer

ftrace: system crash when changing current_tracer from function_graph via echo

I have been playing with ftrace recently to monitor some behavior characteristics of my system. I've been handling switching the trace on/off via a small script. After running the script, my system would crash and reboot itself. Initially, I…
buratino
  • 1,408
  • 2
  • 17
  • 40
12
votes
2 answers

How to make a linux kernel function available to ftrace function_graph tracer?

I want to trace a function during kernel boot process with ftrace function_graph to understand what it does, but it is not available in available_filter_functions. I tried to export it with EXPORT_SYMBOL(), guessing that it will made it available…
Jeremy Rocher
  • 155
  • 1
  • 9
9
votes
1 answer

use trace-cmd/ftrace to get function_graph just before panic() happened

I am trying to use trace-cmd to gather more information about a kernel crash that I am seeing. Unfortunately, kernel crashes with "kernel panic - not syncing" message (i.e. socket and file buffers are not flushed so whatever was in the buffers at…
user389238
  • 1,656
  • 3
  • 19
  • 40
9
votes
1 answer

Are tracepoints redundant in Linux kernel after kprobes support for ftrace?

What are the use-cases for using tracepoint events when kprobe events support for ftrace is available in Linux kernel? It seems everything that is possible to be done using 'tracepoint events' is possible using kprobe events, since one can set up a…
gabhijit
  • 3,345
  • 2
  • 23
  • 36
7
votes
2 answers

Android Systrace Trace File Format

Android systrace tool, calls atrace tool via ADB. However, I don't understand very well the format of the traces file. Apparently it is very similar to linux ftrace tool with some differences. The main difference is that is doesn't uses a System.Map…
Rodmar Conde
  • 956
  • 1
  • 12
  • 24
6
votes
2 answers

Performance Overhead of Perf Event Subsystem in Linux Kernel

Performance counters for Linux are a new kernel-based subsystem that provide a framework for all things performance analysis. It covers hardware level (CPU/PMU, Performance Monitoring Unit) features and software features (software counters,…
6
votes
2 answers

Does ftrace allow capture of system call arguments to the Linux kernel, or only function names?

The goal is to examine arguments passed to specific system calls (e.g. exec, open, etc.) by any process. From the official documentation, no capability to log function arguments is described (looked mostly at the "function" tracer, as I don't need…
MaxVT
  • 12,989
  • 6
  • 36
  • 50
6
votes
7 answers

How do I benchmark or trace a specific function in the Linux Kernel?

How do I use ftrace() (or anything else) to trace a specific, user-defined function in the Linux kernel? I'm trying to create and run some microbenchmarks, so I'd like to have the time it takes certain functions to run. I've read through (at least…
Ricky Mutschlechner
  • 4,291
  • 2
  • 31
  • 36
6
votes
1 answer

Good explanation/documentation on ftrace

I just read that the 2.6.27 kernel has a new module called ftrace which sounds a lot like suns dtrace utility. I'm having some trouble googling for documentation, I was wondering if anyone else had something. Is this something that is going to be…
William
  • 6,338
  • 4
  • 32
  • 36
5
votes
1 answer

Capturing user-space assembly with ftrace and kprobes (by using virtual address translation)?

Apologies for the longish post, I'm having trouble formulating it in a shorter way. Also, maybe this is more appropriate for Unix & Linux Stack Exchange, but I'll try here at SO first, as there is an ftrace tag. Anyways - I'd like to observe do…
sdaau
  • 36,975
  • 46
  • 198
  • 278
4
votes
1 answer

How to properly port the "dynamic ftrace wtih registers" support to the Pixel 3a ARM64 kernel?

I'm currently working to integrate the ARM64 ftrace patches to enable the full support to "dynamic ftrace with registers". Specifically I'm working on the 4.9.200 kernel version for the Pixel 3a (sargo) and the patches I'm referring to are the…
Matteo Favaro
  • 61
  • 1
  • 4
4
votes
2 answers

How to trace just system call events with ftrace without showing any other functions in the Linux kernel?

For example, to monitor all mkdir calls made, the best I could come up with was: #!/bin/sh set -eux d=debug/tracing mkdir -p debug if ! mountpoint -q debug; then mount -t debugfs nodev debug fi # Stop tracing. echo 0 > "${d}/tracing_on" #…
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
4
votes
1 answer

What kind of functions will be put in available list on ftrace in Linux?

I found not every function on the same file is listed in the /sys/kernel/debug/tracing/available_filter_functions for ftrace. For example, blk_mq_map_swqueue() is listed but blk_mq_add_queue_tag_set() is not even though there are on the file…
codexplorer
  • 541
  • 5
  • 21
4
votes
0 answers

Using ftrace to see kernel function arguments

I have had a ton of problems with SystemTap and am looking to test out ftrace. In specific, I am looking to monitor a function's arguments in real-time. I have read the ftrace documentation, but am having trouble piecing together the instructions to…
Farhan Yusufzai
  • 297
  • 6
  • 23
4
votes
1 answer

Is it possible to use eBPF or perf to calculate time spent in individual traced functions?

Currently, I can tell trace-cmd (an ftrace front-end) to use ftrace's function graph infrastructure to trace a specified workload. Using some trace data processing tools, I can look at the frequency with which functions were called and the…
buratino
  • 1,408
  • 2
  • 17
  • 40
1
2 3
8 9