diff options
author | Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com> | 2025-02-06 14:33:15 +0300 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2025-02-20 00:55:59 +0300 |
commit | 4bac7fb5862740087825eda3ed6168e91da8b7e6 (patch) | |
tree | 8d58716be83fe1892389f1d868089a4fcf933022 /tools/perf/util/trace-event-scripting.c | |
parent | 6353255e7cfab568058580424fa0967bf4504fe5 (diff) | |
download | linux-4bac7fb5862740087825eda3ed6168e91da8b7e6.tar.xz |
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: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com>
Acked-by: Howard Chu <howardchu95@gmail.com>
Link: https://lore.kernel.org/r/20250206113314.335376-2-krzysztof.m.lopatowski@gmail.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions