Commit 4bac7fb5 authored by Krzysztof Łopatowski's avatar Krzysztof Łopatowski Committed by Namhyung Kim
Browse files

perf tools: Improve startup time by reducing unnecessary stat() calls



When testing perf trace on NixOS, I noticed significant startup delays:
- `ls`: ~2ms
- `strace ls`: ~10ms
- `perf trace ls`: ~550ms

Profiling showed that 51% of the time is spent reading files,
26% in loading BPF programs, and 11% in `newfstatat`.

This patch optimizes module path exploration by avoiding `stat()` calls
unless necessary. For filesystems that do not implement `d_type`
(DT_UNKNOWN), it falls back to the old behavior.
See `readdir(3)` for details.

This reduces `perf trace ls` time to ~500ms.

A more thorough startup optimization based on command parameters would
be ideal, but that is a larger effort.

Signed-off-by: default avatarKrzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com>
Acked-by: default avatarHoward Chu <howardchu95@gmail.com>
Link: https://lore.kernel.org/r/20250206113314.335376-2-krzysztof.m.lopatowski@gmail.com


Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 6353255e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment