Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191351
b: refs/heads/master
c: 3798ed7
h: refs/heads/master
i:
  191349: 4ee2ec9
  191347: 8ffcbc1
  191343: 24e299f
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed May 11, 2010
1 parent 7a6970a commit ead1359
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d11c7addfe0fa501cb54c824c0fac3481d527433
refs/heads/master: 3798ed7bc7ade26d3f59506cd06288615dfc7585
69 changes: 50 additions & 19 deletions trunk/tools/perf/util/newt.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,43 @@ void ui_progress__delete(struct ui_progress *self)
free(self);
}

static void ui_helpline__pop(void)
{
newtPopHelpLine();
}

static void ui_helpline__push(const char *msg)
{
newtPushHelpLine(msg);
}

static void ui_helpline__vpush(const char *fmt, va_list ap)
{
char *s;

if (vasprintf(&s, fmt, ap) < 0)
vfprintf(stderr, fmt, ap);
else {
ui_helpline__push(s);
free(s);
}
}

static void ui_helpline__fpush(const char *fmt, ...)
{
va_list ap;

va_start(ap, fmt);
ui_helpline__vpush(fmt, ap);
va_end(ap);
}

static void ui_helpline__puts(const char *msg)
{
ui_helpline__pop();
ui_helpline__push(msg);
}

static char browser__last_msg[1024];

int browser__show_help(const char *format, va_list ap)
Expand All @@ -69,8 +106,7 @@ int browser__show_help(const char *format, va_list ap)
backlog += ret;

if (browser__last_msg[backlog - 1] == '\n') {
newtPopHelpLine();
newtPushHelpLine(browser__last_msg);
ui_helpline__puts(browser__last_msg);
newtRefresh();
backlog = 0;
}
Expand Down Expand Up @@ -340,7 +376,7 @@ static void map_symbol__annotate_browser(const struct map_symbol *self,
if (fp == NULL)
goto out_free_str;

newtPushHelpLine("Press ESC to exit");
ui_helpline__push("Press ESC to exit");
newtGetScreenSize(&cols, &rows);
tree = newtListbox(0, 0, rows - 5, NEWT_FLAG_SCROLL);

Expand Down Expand Up @@ -370,7 +406,7 @@ static void map_symbol__annotate_browser(const struct map_symbol *self,
newtFormRun(form, &es);
newtFormDestroy(form);
newtPopWindow();
newtPopHelpLine();
ui_helpline__pop();
out_free_str:
free(str);
}
Expand Down Expand Up @@ -539,7 +575,7 @@ int hists__browse(struct hists *self, const char *helpline, const char *input_na
if (browser == NULL)
return -1;

newtPushHelpLine(helpline);
ui_helpline__push(helpline);

hist_browser__title(msg, sizeof(msg), input_name,
dso_filter, thread_filter);
Expand Down Expand Up @@ -602,22 +638,19 @@ int hists__browse(struct hists *self, const char *helpline, const char *input_na
do_annotate:
if (choice == annotate) {
if (browser->selection->map->dso->origin == DSO__ORIG_KERNEL) {
newtPopHelpLine();
newtPushHelpLine("No vmlinux file found, can't "
ui_helpline__puts("No vmlinux file found, can't "
"annotate with just a "
"kallsyms file");
continue;
}
map_symbol__annotate_browser(browser->selection, input_name);
} else if (choice == zoom_dso) {
if (dso_filter) {
newtPopHelpLine();
ui_helpline__pop();
dso_filter = NULL;
} else {
snprintf(msg, sizeof(msg),
"To zoom out press -> + \"Zoom out of %s DSO\"",
dso->kernel ? "the Kernel" : dso->short_name);
newtPushHelpLine(msg);
ui_helpline__fpush("To zoom out press -> + \"Zoom out of %s DSO\"",
dso->kernel ? "the Kernel" : dso->short_name);
dso_filter = dso;
}
hists__filter_by_dso(self, dso_filter);
Expand All @@ -627,14 +660,12 @@ int hists__browse(struct hists *self, const char *helpline, const char *input_na
goto out;
} else if (choice == zoom_thread) {
if (thread_filter) {
newtPopHelpLine();
ui_helpline__pop();
thread_filter = NULL;
} else {
snprintf(msg, sizeof(msg),
"To zoom out press -> + \"Zoom out of %s(%d) thread\"",
(thread->comm_set ? thread->comm : ""),
thread->pid);
newtPushHelpLine(msg);
ui_helpline__fpush("To zoom out press -> + \"Zoom out of %s(%d) thread\"",
thread->comm_set ? thread->comm : "",
thread->pid);
thread_filter = thread;
}
hists__filter_by_thread(self, thread_filter);
Expand All @@ -658,7 +689,7 @@ void setup_browser(void)
use_browser = true;
newtInit();
newtCls();
newtPushHelpLine(" ");
ui_helpline__puts(" ");
}

void exit_browser(bool wait_for_ok)
Expand Down

0 comments on commit ead1359

Please sign in to comment.