User → kernel: follow a UDP send
从用户态到内核态:追踪一次 UDP 发送
Follow main → run_round → exchange_loopback → send_frame → dispatch_datagram → sendto → __x64_sys_sendto in a real QEMU capture.
Select dispatch_datagram for its recorded address, arguments and return value. The thin line marks the linked kernel call; Text underlines its K tag.
在真实的 QEMU 记录中,沿 main → run_round → exchange_loopback → send_frame → dispatch_datagram → sendto → __x64_sys_sendto 下探。
选中 dispatch_datagram 可看记录的地址、参数和返回值。细线标在内核调用顶边,Text 中对应入口的 K 带下划线。
Kernel-only: source and error paths
纯内核态:源码与错误路径
The sample: one process reads and writes 4 KB and sends a UDP datagram to itself (QEMU x86_64, Linux 7.4-rc2; 485 recorded calls).
Selected: process_backlog, 24.21 us in the loopback softirq receive path; source links are pinned to the matching upstream tag.
示例:一个进程读写 4 KB 文件,再通过 loopback 给自己发一个 UDP 包(QEMU x86_64,Linux 7.4-rc2;485 次记录调用)。
选中的是 loopback 软中断接收路径中的 process_backlog,耗时 24.21 us;源码链接固定到匹配的上游标签。
What it shows
能看到什么
Choose a CPU, task or recorded event type from the report's menus, and combine those selections with text search.
Per-task flame chart over time, CPU tracks, off-CPU periods, wakeup arrows and wait chains.
Each call split into own code, traced callees, interrupts and blocked/preempted time, with an overhead estimate.
Errnos from funcgraph-retval followed from their origin to user space, checked against BTF return types.
irqs-off, preempt-off and BH-off regions, scheduling latency windows, sleeping in atomic context.
Call sites resolved to file:line with their inline chain and highlighted source.
Per-function differences between two traces; JSON/CSV export for scripts and CI.
从报告的菜单中选择 CPU、任务或已记录的事件类型,还可以叠加文本搜索。
按任务的时序火焰图、CPU 轨道、off-CPU 时段、唤醒箭头和等待链。
每次调用拆分为自身代码、被跟踪的子调用、中断、阻塞/被抢占时间,并估算跟踪开销。
根据 funcgraph-retval 从错误源头一路追到用户态,并用 BTF 返回类型校验。
关中断、关抢占、关软中断的区间,调度延迟窗口,在原子上下文里睡眠。
调用点解析到文件和行号,附内联链和语法高亮的源码。
两份 trace 按函数对比;JSON/CSV 导出,便于脚本和 CI 使用。
Try it
快速上手
# on the target, as root: capture one command with the timeline options# 在目标机上(root):采集一条命令,打开时间轴需要的选项 fgcapture.sh --sched --calibrate -o trace.txt -- cat /etc/hostname # on the host# 在主机上 python3 funcgraph.py --timeline --enable-fold --filter --fast \ --vmlinux vmlinux --kernel-src linux --output report.html trace.txt