mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 23:24:50 +00:00
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>
This commit is contained in:
parent
d11007703c
commit
1d90f2e707
1 changed files with 13 additions and 2 deletions
|
@ -43,6 +43,9 @@ struct ui_progress *ui_progress__new(const char *title, u64 total)
|
|||
|
||||
if (self != NULL) {
|
||||
int cols;
|
||||
|
||||
if (use_browser <= 0)
|
||||
return self;
|
||||
newtGetScreenSize(&cols, NULL);
|
||||
cols -= 4;
|
||||
newtCenteredWindow(cols, 1, title);
|
||||
|
@ -67,14 +70,22 @@ struct ui_progress *ui_progress__new(const char *title, u64 total)
|
|||
|
||||
void ui_progress__update(struct ui_progress *self, u64 curr)
|
||||
{
|
||||
/*
|
||||
* FIXME: We should have a per UI backend way of showing progress,
|
||||
* stdio will just show a percentage as NN%, etc.
|
||||
*/
|
||||
if (use_browser <= 0)
|
||||
return;
|
||||
newtScaleSet(self->scale, curr);
|
||||
newtRefresh();
|
||||
}
|
||||
|
||||
void ui_progress__delete(struct ui_progress *self)
|
||||
{
|
||||
newtFormDestroy(self->form);
|
||||
newtPopWindow();
|
||||
if (use_browser > 0) {
|
||||
newtFormDestroy(self->form);
|
||||
newtPopWindow();
|
||||
}
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue