From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Stephane Eranian" <eranian@google.com>,
"Tom Zanussi" <tzanussi@gmail.com>
Subject: [PATCH 4/6] perf ui: Separate showing the entries from running the browser
Date: Fri, 25 Jun 2010 10:59:24 -0300 [thread overview]
Message-ID: <1277474366-7958-5-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1277474366-7958-1-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Another patch eroding the changes I had to move to a tree widget that
doesn't requires adding all entries in an existing list/tree structure
to a generic tree widget, but instead allows traversing just the entries
that should appear on the screen on a given moment.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/newt.c | 60 +++++++++++++++++++++++------------------------
1 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 0ffc828..9fa5b20 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -328,6 +328,32 @@ static void ui_browser__reset_index(struct ui_browser *self)
self->seek(self, 0, SEEK_SET);
}
+static int ui_browser__show(struct ui_browser *self, const char *title)
+{
+ if (self->form != NULL)
+ return 0;
+ ui_browser__refresh_dimensions(self);
+ newtCenteredWindow(self->width + 2, self->height, title);
+ self->form = newt_form__new();
+ if (self->form == NULL)
+ return -1;
+
+ self->sb = newtVerticalScrollbar(self->width + 1, 0, self->height,
+ HE_COLORSET_NORMAL,
+ HE_COLORSET_SELECTED);
+ if (self->sb == NULL)
+ return -1;
+
+ newtFormAddHotKey(self->form, NEWT_KEY_UP);
+ newtFormAddHotKey(self->form, NEWT_KEY_DOWN);
+ newtFormAddHotKey(self->form, NEWT_KEY_PGUP);
+ newtFormAddHotKey(self->form, NEWT_KEY_PGDN);
+ newtFormAddHotKey(self->form, NEWT_KEY_HOME);
+ newtFormAddHotKey(self->form, NEWT_KEY_END);
+ newtFormAddComponent(self->form, self->sb);
+ return 0;
+}
+
static int objdump_line__show(struct objdump_line *self, struct list_head *head,
int width, struct hist_entry *he, int len,
bool current_entry)
@@ -406,39 +432,10 @@ static int ui_browser__refresh_entries(struct ui_browser *self)
return 0;
}
-static int ui_browser__run(struct ui_browser *self, const char *title,
- struct newtExitStruct *es)
+static int ui_browser__run(struct ui_browser *self, struct newtExitStruct *es)
{
- if (self->form) {
- newtFormDestroy(self->form);
- newtPopWindow();
- }
-
- ui_browser__refresh_dimensions(self);
- newtCenteredWindow(self->width + 2, self->height, title);
- self->form = newt_form__new();
- if (self->form == NULL)
- return -1;
-
- self->sb = newtVerticalScrollbar(self->width + 1, 0, self->height,
- HE_COLORSET_NORMAL,
- HE_COLORSET_SELECTED);
- if (self->sb == NULL)
- return -1;
-
- newtFormAddHotKey(self->form, NEWT_KEY_UP);
- newtFormAddHotKey(self->form, NEWT_KEY_DOWN);
- newtFormAddHotKey(self->form, NEWT_KEY_PGUP);
- newtFormAddHotKey(self->form, NEWT_KEY_PGDN);
- newtFormAddHotKey(self->form, ' ');
- newtFormAddHotKey(self->form, NEWT_KEY_HOME);
- newtFormAddHotKey(self->form, NEWT_KEY_END);
- newtFormAddHotKey(self->form, NEWT_KEY_TAB);
- newtFormAddHotKey(self->form, NEWT_KEY_RIGHT);
-
if (ui_browser__refresh_entries(self) < 0)
return -1;
- newtFormAddComponent(self->form, self->sb);
while (1) {
off_t offset;
@@ -733,7 +730,8 @@ int hist_entry__tui_annotate(struct hist_entry *self)
}
browser.width += 18; /* Percentage */
- ret = ui_browser__run(&browser, self->ms.sym->name, &es);
+ ui_browser__show(&browser, self->ms.sym->name);
+ ui_browser__run(&browser, &es);
newtFormDestroy(browser.form);
newtPopWindow();
list_for_each_entry_safe(pos, n, &head, node) {
--
1.6.2.5
next prev parent reply other threads:[~2010-06-25 13:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-25 13:59 [GIT PULL 0/6] perf/core improvements and fixes for 2.6.36 Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 1/6] perf scripts perl: Makefile fix Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 2/6] perf ui: Introduce routine ui_browser__is_current_entry Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 3/6] perf ui: Introduce ui_browser->seek to support multiple list structures Arnaldo Carvalho de Melo
2010-06-25 13:59 ` Arnaldo Carvalho de Melo [this message]
2010-06-25 13:59 ` [PATCH 5/6] perf ui: Move objdump_line specific stuff out of ui_browser Arnaldo Carvalho de Melo
2010-06-25 13:59 ` [PATCH 6/6] perf kvm: Get rid of unused guest_kallsyms Arnaldo Carvalho de Melo
2010-06-25 14:17 ` [GIT PULL 0/6] perf/core improvements and fixes for 2.6.36 Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1277474366-7958-5-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®