perf is a quite handy tool to quickly measure performance of your
application on GNU/Linux without recompiling it. The only issue seemed to be
inconvenience of viewing report in a pager. It turned into concern after
realising that it should start TUI on
perf report by default, but
for some reason it didn't.
Everything is quite simple:
perf record -g command arg1 arg2 perf report
There are three ways of viewing report which can be selected via options:
--stdioruns a pager.
--tuishould start TUI (default when output is a tty).
--gtkstarts simple GTK application, which seems to only be able to display table of results without any actions which are available in the TUI.
Even explicitly specifying
--tui didn't make TUI start.
The situation got even more confusing after seeing via strace
libncurses is loaded by the process.
Since the issue doesn't seem to happen to many people according to an Internet
search, the next step was to look at the sources, with the first result giving
the clue of what's actually going on (from
# ... ifneq ($(feature-libslang), 1) msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); NO_SLANG := 1 else # ...
Since TUI just gets silently disabled during build if
available, the obvious solution is to install S-Lang and rebuild
The TUI itself unfortunately doesn't have Vim-like key bindings and since all
keys are hard-coded it can't be configured. Anyway, it's more convenient than a
pager where one needs to rerun
perf multiple times with different options.
Advice to software developers
Either drop options on disabling a feature or print a warning when user tries
to use them. Another useful thing to do is to mention how things are build in
--version information or even actually stopping build instead of just printing
a warning, which is easy to miss.