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>

+13 -2
+13 -2
tools/perf/util/newt.c
··· 43 43 44 44 if (self != NULL) { 45 45 int cols; 46 + 47 + if (use_browser <= 0) 48 + return self; 46 49 newtGetScreenSize(&cols, NULL); 47 50 cols -= 4; 48 51 newtCenteredWindow(cols, 1, title); ··· 70 67 71 68 void ui_progress__update(struct ui_progress *self, u64 curr) 72 69 { 70 + /* 71 + * FIXME: We should have a per UI backend way of showing progress, 72 + * stdio will just show a percentage as NN%, etc. 73 + */ 74 + if (use_browser <= 0) 75 + return; 73 76 newtScaleSet(self->scale, curr); 74 77 newtRefresh(); 75 78 } 76 79 77 80 void ui_progress__delete(struct ui_progress *self) 78 81 { 79 - newtFormDestroy(self->form); 80 - newtPopWindow(); 82 + if (use_browser > 0) { 83 + newtFormDestroy(self->form); 84 + newtPopWindow(); 85 + } 81 86 free(self); 82 87 } 83 88