perf report: Add --no-progress option

Now that --progress is being added for the stdio case, wire up its
counterpart for the browsers: the TUI and GTK ones present progress of
their own and there is no way to turn it off.  Install the no-op
ui_progress ops, the ones already used until a backend sets theirs,
after setup_browser() installed the ones of the browser in use.  The
phases are still counted, nothing is shown for them, and no second
option is needed for it: parse-options provides --no-progress as the
negation of --progress, report.progress_set saying that it was asked
for, report.progress being false both when nothing was asked for and
when --no-progress was.

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Assisted-by: LLM
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2026-10-06 16:57:28 +02:00
parent 44ce6270eb
commit 6a98990010
4 changed files with 19 additions and 3 deletions

View File

@ -43,6 +43,11 @@ OPTIONS
present progress information, or when --quiet is used, that asks
for no messages at all.
--no-progress::
Do not show progress while processing the perf.data file. It
also turns off the progress the TUI and GTK browsers present,
which is their own.
-n::
--show-nr-samples::
Show the number of samples for each symbol

View File

@ -88,6 +88,7 @@ struct report {
#endif
bool use_stdio;
bool progress;
bool progress_set;
bool show_full_info;
bool show_threads;
bool inverted_callchain;
@ -1385,8 +1386,8 @@ int cmd_report(int argc, const char **argv)
"Use the stdio interface"),
OPT_BOOLEAN(0, "weights", &symbol_conf.annotate_weight,
"Show or hide weight columns in annotation. Default show if non-zero."),
OPT_BOOLEAN(0, "progress", &report.progress,
"Show progress while processing the perf.data file"),
OPT_BOOLEAN_SET(0, "progress", &report.progress, &report.progress_set,
"Show progress while processing the perf.data file"),
OPT_BOOLEAN(0, "header", &report.header, "Show data header."),
OPT_BOOLEAN(0, "header-only", &report.header_only,
"Show only data header."),
@ -1793,7 +1794,9 @@ int cmd_report(int argc, const char **argv)
else
use_browser = 0;
if (report.progress && !quiet && use_browser == 0)
if (report.progress_set && !report.progress)
ui_progress__noop_init();
else if (report.progress && !quiet && use_browser == 0)
stdio_progress__init();
if (report.data_type && use_browser == 1) {

View File

@ -13,6 +13,12 @@ static struct ui_progress_ops null_progress__ops =
struct ui_progress_ops *ui_progress__ops = &null_progress__ops;
/* Everything counts but nothing is shown, the way it starts out. */
void ui_progress__noop_init(void)
{
ui_progress__ops = &null_progress__ops;
}
void ui_progress__update(struct ui_progress *p, u64 adv)
{
u64 last = p->curr;

View File

@ -25,6 +25,8 @@ void ui_progress__update(struct ui_progress *p, u64 adv);
void stdio_progress__init(void);
void ui_progress__noop_init(void);
struct ui_progress_ops {
void (*init)(struct ui_progress *p);
void (*update)(struct ui_progress *p);