From 1d90f2e707e75afdb6b644f774cf5e54dc9c33fc Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 9 Jun 2010 07:13:16 -0300 Subject: perf record: Don't call newt functions when not initialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Srikar Dronamraju Cc: Ananth N Mavinakayanahalli Cc: Frédéric Weisbecker Cc: Ingo Molnar Cc: Masami Hiramatsu , Cc: Peter Zijlstra Cc: Srikar Dronamraju Cc: Stephane Eranian Cc: Tom Zanussi LKML-Reference: <20100609123530.GB9471@ghostprotocols.net> Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/newt.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index cf182ca132f..7537ca15900 100644 --- a/tools/perf/util/newt.c +++ b/tools/perf/util/newt.c @@ -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 @@ out_free_self: 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); } -- cgit v1.2.3