diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-06-09 06:13:16 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-06-10 07:29:19 -0400 |
| commit | 1d90f2e707e75afdb6b644f774cf5e54dc9c33fc (patch) | |
| tree | d5bc78d60ac4462ff544f394da94361ead1447d3 | |
| parent | d11007703c31db534674ebeeb9eb047bbbe758bd (diff) | |
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>
| -rw-r--r-- | tools/perf/util/newt.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index cf182ca132fe..7537ca15900b 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) | |||
| 43 | 43 | ||
| 44 | if (self != NULL) { | 44 | if (self != NULL) { |
| 45 | int cols; | 45 | int cols; |
| 46 | |||
| 47 | if (use_browser <= 0) | ||
| 48 | return self; | ||
| 46 | newtGetScreenSize(&cols, NULL); | 49 | newtGetScreenSize(&cols, NULL); |
| 47 | cols -= 4; | 50 | cols -= 4; |
| 48 | newtCenteredWindow(cols, 1, title); | 51 | newtCenteredWindow(cols, 1, title); |
| @@ -67,14 +70,22 @@ out_free_self: | |||
| 67 | 70 | ||
| 68 | void ui_progress__update(struct ui_progress *self, u64 curr) | 71 | void ui_progress__update(struct ui_progress *self, u64 curr) |
| 69 | { | 72 | { |
| 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; | ||
| 70 | newtScaleSet(self->scale, curr); | 79 | newtScaleSet(self->scale, curr); |
| 71 | newtRefresh(); | 80 | newtRefresh(); |
| 72 | } | 81 | } |
| 73 | 82 | ||
| 74 | void ui_progress__delete(struct ui_progress *self) | 83 | void ui_progress__delete(struct ui_progress *self) |
| 75 | { | 84 | { |
| 76 | newtFormDestroy(self->form); | 85 | if (use_browser > 0) { |
| 77 | newtPopWindow(); | 86 | newtFormDestroy(self->form); |
| 87 | newtPopWindow(); | ||
| 88 | } | ||
| 78 | free(self); | 89 | free(self); |
| 79 | } | 90 | } |
| 80 | 91 | ||
