Skip to content

Commit 1d90f2e

Browse files
committed
perf record: Don't call newt functions when not initialized
When processing events we want to give visual feedback to the user when using the newt browser, so there are ui_progress calls in __perf_session__process_events, but those should check if newt is being used. Reported-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Tested-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>, Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20100609123530.GB9471@ghostprotocols.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent d110077 commit 1d90f2e

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎tools/perf/util/newt.c‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ struct ui_progress *ui_progress__new(const char *title, u64 total)
4343

4444
if (self != NULL) {
4545
int cols;
46+
47+
if (use_browser <= 0)
48+
return self;
4649
newtGetScreenSize(&cols, NULL);
4750
cols -= 4;
4851
newtCenteredWindow(cols, 1, title);
@@ -67,14 +70,22 @@ struct ui_progress *ui_progress__new(const char *title, u64 total)
6770

6871
void ui_progress__update(struct ui_progress *self, u64 curr)
6972
{
73+
/*
74+
* FIXME: We should have a per UI backend way of showing progress,
75+
* stdio will just show a percentage as NN%, etc.
76+
*/
77+
if (use_browser <= 0)
78+
return;
7079
newtScaleSet(self->scale, curr);
7180
newtRefresh();
7281
}
7382

7483
void ui_progress__delete(struct ui_progress *self)
7584
{
76-
newtFormDestroy(self->form);
77-
newtPopWindow();
85+
if (use_browser > 0) {
86+
newtFormDestroy(self->form);
87+
newtPopWindow();
88+
}
7889
free(self);
7990
}
8091

0 commit comments

Comments
 (0)