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
0
votes
0 answers

When using FTrace in docker container, how to collect PID inside container instead of on host system?

I tried to use FTrace inside docker container. FTrace will collect the PID for each event, and I noticed that the PID is actually the host PID, not the PID inside the container. Is there a way to make FTrace record the PID inside the container,…
Liuyi Shi
  • 1
  • 1
0
votes
0 answers

ftrace unable to capture mem_buf and some other events

I'm using ftrace to trace memory usage in applications I am running. I have no problem tracing sched and power events for tracking the scheduler and cpu frequency, but when it comes to tracking allocation of memory in my application I am not seeing…
Kron
  • 23
  • 5
0
votes
0 answers

It is possible to grab process memory using ftrace?

I have two applications one writing requests to and reading responses from stdin/stdout of another. I should not modify the applications, but I have root permission. I need to intercept requests, and responses and measure time when some messages…
user2616346
  • 465
  • 1
  • 5
  • 12
0
votes
0 answers

How to configure Ftrace on kernel 5.15.0-56-generic (ubuntu 22.04)?

I'm trying to configure and enable ftrace on my ubuntu machine but its doesn't work. I also tried the instructions from the link here. I'm sure I'm missing something minor but I can't tell what. Configuration: $ cat /boot/config-5.15.0-56-generic |…
chandra_cst
  • 307
  • 2
  • 13
0
votes
0 answers

What does the field irq indicate in the kvm_inj_virq event?

I have generated trace on an intel machine through trace-cmd(ftrace) while running virtual machines through KVM/QEMU hypervisor. In the kvm_inj_virq event, the irq field is a number indicating the kind of interrupt that's getting inserted. But I…
TNT Captain
  • 1
  • 1
  • 1
0
votes
1 answer

Best way to convert a Linux kernel trace point into a plain old printk

I work in a system that does not allow me to enable tracepoints at runtime. To work around this, I manually add printks near a trace point to during debugging. This seems to be very inefficient and I am looking for methods to enable a tracepoint at…
sidcha
  • 649
  • 5
  • 18
0
votes
1 answer

how to use ftrace to hook kernel function in arm64 linux kernel?

I tried to use ftrace to hook kernel functions in arm64 kernel, but failed. Some important parts of my code are as follows: static void notrace ftrace_hook_handler(size_t ip, size_t parent_ip, struct ftrace_ops *ops, struct ftrace_regs *fregs) { …
hdthky
  • 57
  • 1
  • 4
0
votes
1 answer

How to convert an ASCII trace generated by ftrace to a .dat one?

I have a ASCII trace named trace and I'd like to convert it to a .dat in order to analyze it with kernelshark (I cannot change tool such as TraceCompass, I am constrained to kernelshark). These two tools of trace-cmd frontend are somehow similar to…
MM92x
  • 548
  • 1
  • 4
  • 25
0
votes
1 answer

Linux-ftrace: why code profiling is achieved through mcount function (gcc `-pg` option)?

With this question I aim to do a survey about instrumentation techniques used by linux ftrace. According with ftrace.txt: If CONFIG_DYNAMIC_FTRACE is set, the system will run with virtually no overhead when function tracing is disabled. The…
MM92x
  • 548
  • 1
  • 4
  • 25
0
votes
1 answer

Enable event tracing upon kernel module load

I want to use Ftrace event tracer for my kernel module. It is important to me that I'll be able to trace right when the module loads- in similar fashion to enabling events during boot via the kernel command line. I had no success with it, I did saw…
user2063776
  • 201
  • 1
  • 2
  • 4
0
votes
1 answer

ftrace cannot trace some kernel functions

I'm using ftrace to trace ip_local_out() in kernel 5.4.20. I'm sure ip_local_out() is available to trace: /sys/kernel/debug/tracing # cat available_filter_functions |grep ip_local_out __ip_local_out ip_local_out So I set up ftrace and start to…
crezov
  • 1
  • 3
0
votes
1 answer

Convert function_graph's tree to a dictionary

The function_graph tracer outputs what appears to be a time-dependent tree in a format similar to a C-code and/or JSON. Is there a python3 built-in that converts it to a dict? example of txt (at the end of each line there is a \n): __fdget() { …
Gaston
  • 537
  • 4
  • 10
0
votes
1 answer

The trace-cmd report do not show the function name

I used the following command to trace the kernel. $ trace-cmd record -p function_graph ls $ trace-cmd report but I saw the following result just show the address instead of the function name. MtpServer-4877 [000] 1706.014074:…
wenhung
  • 1
  • 1
0
votes
0 answers

linux ftrace does not give any trace for loaded module

I have written a test kernel module named hello.ko which spawns a kernel thread with the following function : static int thread_fn(void *data) { while(1) { printk(KERN_INFO "thread is running....\n"); ssleep(5); …
Naveen
  • 7,944
  • 12
  • 78
  • 165
0
votes
1 answer

Failed to trace the trace point of softirq_raise in Linux-5.11.4

I am writing a kernel module to hook to the trace point of softirq_raise. I found it could be shown in /sys/kernel/debug/tracing/available_events:irq:softirq_raise …
wangt13
  • 959
  • 7
  • 17
1 2 3
8 9