Skip to contentSkip to conversation

perf/core ui browser improvement

GIT PULL New Arnaldo Carvalho de Melo 4 participants 9 messages Sep 13, 2010 – Sep 14, 2010 perf events

lore
Share & tools
lore
#0 lore raw

From: Arnaldo Carvalho de Melo <[email protected]>

Hi Ingo,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core

Screenshot showing how it looks like now:

http://vger.kernel.org/~acme/perf/perf-report-tui-no-windows.png

Regards,

- Arnaldo

Arnaldo Carvalho de Melo (1):
perf ui browser: Don't use windows, slang is enough

 tools/perf/util/ui/browser.c        |   24 +++++++++-----------
 tools/perf/util/ui/browsers/hists.c |   41 ++++++++++++++++------------------
 tools/perf/util/ui/browsers/map.c   |    9 +++----
 3 files changed, 34 insertions(+), 40 deletions(-)
#1 lore raw

PATCH 1/1 perf ui browser: Don't use windows, slang is enough

From: Arnaldo Carvalho de Melo <[email protected]>

They are useless and take away precious columns and lines, so stop using windows.

One more step in removing newt code, that after all is not being useful at all for the coalescing TUI model in perf.

Cc Christoph Hellwig <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Tom Zanussi <[email protected]>

LKML-Reference: <[email protected]>

---
 tools/perf/util/ui/browser.c        |   24 +++++++++-----------
 tools/perf/util/ui/browsers/hists.c |   41 ++++++++++++++++------------------
 tools/perf/util/ui/browsers/map.c   |    9 +++----
 3 files changed, 34 insertions(+), 40 deletions(-)
tools/perf/util/ui/browser.c +11 -13
index 930c4ac..6d0df80 100644
@@ -130,13 +130,10 @@ void ui_browser__refresh_dimensions(struct ui_browser *self)
 	int cols, rows;
 	newtGetScreenSize(&cols, &rows);
 
-	if (self->width > cols - 4)
-		self->width = cols - 4;
-	self->height = rows - 5;
-	if (self->height > self->nr_entries)
-		self->height = self->nr_entries;
-	self->y  = (rows - self->height) / 2;
-	self->x = (cols - self->width) / 2;
+	self->width = cols - 1;
+	self->height = rows - 2;
+	self->y = 1;
+	self->x = 0;
 }
 
 void ui_browser__reset_index(struct ui_browser *self)
@@ -168,22 +165,24 @@ int ui_browser__show(struct ui_browser *self, const char *title,
 		       NEWT_KEY_PGDN, NEWT_KEY_HOME, NEWT_KEY_END, ' ',
 		       NEWT_KEY_LEFT, NEWT_KEY_ESCAPE, 'q', CTRL('c'), 0 };
 
-	if (self->form != NULL) {
+	if (self->form != NULL)
 		newtFormDestroy(self->form);
-		newtPopWindow();
-	}
+
 	ui_browser__refresh_dimensions(self);
-	newtCenteredWindow(self->width, self->height, title);
 	self->form = newtForm(NULL, NULL, 0);
 	if (self->form == NULL)
 		return -1;
 
-	self->sb = newtVerticalScrollbar(self->width, 0, self->height,
+	self->sb = newtVerticalScrollbar(self->width, 1, self->height,
 					 HE_COLORSET_NORMAL,
 					 HE_COLORSET_SELECTED);
 	if (self->sb == NULL)
 		return -1;
 
+	SLsmg_gotorc(0, 0);
+	ui_browser__set_color(self, NEWT_COLORSET_ROOT);
+	slsmg_write_nstring(title, self->width);
+
 	ui_browser__add_exit_keys(self, keys);
 	newtFormAddComponent(self->form, self->sb);
 
@@ -196,7 +195,6 @@ int ui_browser__show(struct ui_browser *self, const char *title,
 void ui_browser__hide(struct ui_browser *self)
 {
 	newtFormDestroy(self->form);
-	newtPopWindow();
 	self->form = NULL;
 	ui_helpline__pop();
 }
tools/perf/util/ui/browsers/hists.c +19 -22

84 lines not on this page · raw message

tools/perf/util/ui/browsers/map.c +4 -5
index 1bf0979..e35437d 100644
@@ -46,7 +46,6 @@ out_free_form:
 struct map_browser {
 	struct ui_browser b;
 	struct map	  *map;
-	u16		  namelen;
 	u8		  addrlen;
 };
 
@@ -55,13 +54,16 @@ static void map_browser__write(struct ui_browser *self, void *nd, int row)
 	struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
 	struct map_browser *mb = container_of(self, struct map_browser, b);
 	bool current_entry = ui_browser__is_current_entry(self, row);
+	int width;
 
 	ui_browser__set_percent_color(self, 0, current_entry);
 	slsmg_printf("%*llx %*llx %c ",
 		     mb->addrlen, sym->start, mb->addrlen, sym->end,
 		     sym->binding == STB_GLOBAL ? 'g' :
 		     sym->binding == STB_LOCAL  ? 'l' : 'w');
-	slsmg_write_nstring(sym->name, mb->namelen);
+	width = self->width - ((mb->addrlen * 2) + 4);
+	if (width > 0)
+		slsmg_write_nstring(sym->name, width);
 }
 
 /* FIXME uber-kludgy, see comment on cmd_report... */
@@ -139,8 +141,6 @@ int map__browse(struct map *self)
 	for (nd = rb_first(mb.b.entries); nd; nd = rb_next(nd)) {
 		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
 
-		if (mb.namelen < pos->namelen)
-			mb.namelen = pos->namelen;
 		if (maxaddr < pos->end)
 			maxaddr = pos->end;
 		if (verbose) {
@@ -151,6 +151,5 @@ int map__browse(struct map *self)
 	}
 
 	mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr);
-	mb.b.width += mb.addrlen * 2 + 4 + mb.namelen;
 	return map_browser__run(&mb);
 }
Signature · 1 line
1.6.2.5
#2 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 7 lines · Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Hi Ingo,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core

Pulled, thanks Arnaldo!

Quoted 3 lines

Screenshot showing how it looks like now:

http://vger.kernel.org/~acme/perf/perf-report-tui-no-windows.png

Nice, it's more economic with screen real estate now :-)

btw., a small detail: could we please rename [kernel.kallsyms] to [kernel]? The user is not really interested where the symbols came from (kallsyms or vmlinux), in 99.9% of the cases - and the many repetitive .kallsyms instances look uninformative and somewhat confusing.

Thanks,

Ingo

#3 lore raw

Em Mon, Sep 13, 2010 at 07:48:45PM +0200, Ingo Molnar escreveu:

Quoted 6 lines

Nice, it's more economic with screen real estate now :-)

btw., a small detail: could we please rename [kernel.kallsyms] to [kernel]? The user is not really interested where the symbols came from (kallsyms or vmlinux), in 99.9% of the cases - and the many repetitive .kallsyms instances look uninformative and somewhat confusing.

Sure, I'll probably even remove the brackets :-)

- Arnaldo

#4 lore raw
Quoted 9 lines · Arnaldo Carvalho de Melo

Em Mon, Sep 13, 2010 at 07:48:45PM +0200, Ingo Molnar escreveu:

Quoted 6 lines

Nice, it's more economic with screen real estate now :-)

btw., a small detail: could we please rename [kernel.kallsyms] to [kernel]? The user is not really interested where the symbols came from (kallsyms or vmlinux), in 99.9% of the cases - and the many repetitive .kallsyms instances look uninformative and somewhat confusing.

Sure, I'll probably even remove the brackets :-)

The brackets kind of make sense, they signal that it's a container (which it is) - same for DSOs.

Thanks,

Ingo

#5 lore raw

Em Mon, Sep 13, 2010 at 10:42:17PM +0200, Ingo Molnar escreveu:

Quoted 8 lines
Quoted 8 lines

Em Mon, Sep 13, 2010 at 07:48:45PM +0200, Ingo Molnar escreveu:

Quoted 6 lines

Nice, it's more economic with screen real estate now :-)

btw., a small detail: could we please rename [kernel.kallsyms] to [kernel]? The user is not really interested where the symbols came from (kallsyms or vmlinux), in 99.9% of the cases - and the many repetitive .kallsyms instances look uninformative and somewhat confusing.

Quoted 4 lines
Quoted 1 line

Sure, I'll probably even remove the brackets :-)

The brackets kind of make sense, they signal that it's a container (which it is) - same for DSOs.

+      3.00%         find  [kernel.kallsyms]   [k] n_tty_write
+      2.59%         find  [kernel.kallsyms]   [k] _raw_spin_lock_irqsave
+      2.43%         find  find                [.] knuth_morris_pratt_unibyte
+      2.22%         sshd  sshd                [.]            41841
+      2.16%      swapper  [kernel.kallsyms]   [k] mwait_idle
+      1.65%         find  libc-2.12.so        [.] __GI_vfprintf                   

Right now DSOs doesn't use brackets, just the kernel and modules, that differentiates them from userspace DSOs, but then there is the next column, where we have (under brackets) "k", "." or "H" for kernel, userspace, hypervisor, so we can use this info to know the context, no need for brackets around the DSO as well.

Arguably I'd remove also the brackets around the context, they also don't convey useful information IMHO, and also would replace '.' with 'u', so it would become:

+      3.00%         find  kernel       k n_tty_write
+      2.59%         find  kernel       k _raw_spin_lock_irqsave
+      2.43%         find  find         u knuth_morris_pratt_unibyte
+      2.22%         sshd  sshd         u            41841
+      2.16%      swapper  kernel       k mwait_idle
+      1.65%         find  libc-2.12.so u __GI_vfprintf                   

Something else that is missing in the tui is a header with the names of the columns, that is present in the stdio based formatter.

- Arnaldo

maintainer
#6 lore raw

Review

Quoted 3 lines · Arnaldo Carvalho de Melo
(quoted diff) +2 -0
+      3.00%         find  [kernel.kallsyms]   [k] n_tty_write
 
+      3.00%         find  kernel       k n_tty_write

I find that [k] is visually easier to separate from the symbol name.

#7 lore raw
Quoted 6 lines · Peter Zijlstra

Review

Quoted 3 lines · Arnaldo Carvalho de Melo
(quoted diff) +2 -0
+      3.00%         find  [kernel.kallsyms]   [k] n_tty_write
 
+      3.00%         find  kernel       k n_tty_write

I find that [k] is visually easier to separate from the symbol name.

me too. Something like:

before:

     1.08%           cc1  libc-2.12.so                  [.] _int_malloc
     0.94%           cc1  [kernel.kallsyms]             [k] clear_page_c
     0.74%           cc1  libc-2.12.so                  [.] _int_free
     0.69%           cc1  [kernel.kallsyms]             [k] page_fault
     0.46%           cc1  libc-2.12.so                  [.] malloc_consolidate

after:

     1.08%           cc1  # libc-2.12.so                [.] _int_malloc
     0.94%           cc1  # kernel                      [k] clear_page_c
     0.74%           cc1  # libc-2.12.so                [.] _int_free
     0.69%           cc1  # kernel                      [k] page_fault
     0.46%           cc1  # libc-2.12.so                [.] malloc_consolidate

Would largely do the trick i think. The comments delineate the DSO portion from the task portion nicely - while also being a familar pattern. The column of [.] and [k] gives kernel developers a quick glance wrt. whether it's kernel or user-space - and it also delineates the symbol column from the DSO column.

Thanks,

Ingo

#8 lore raw
Quoted 35 lines · Ingo Molnar
Quoted 6 lines · Peter Zijlstra

Review

Quoted 3 lines · Arnaldo Carvalho de Melo
(quoted diff) +2 -0
+      3.00%         find  [kernel.kallsyms]   [k] n_tty_write
 
+      3.00%         find  kernel       k n_tty_write

I find that [k] is visually easier to separate from the symbol name.

me too. Something like:

before:

     1.08%           cc1  libc-2.12.so                  [.] _int_malloc
     0.94%           cc1  [kernel.kallsyms]             [k] clear_page_c
     0.74%           cc1  libc-2.12.so                  [.] _int_free
     0.69%           cc1  [kernel.kallsyms]             [k] page_fault
     0.46%           cc1  libc-2.12.so                  [.] malloc_consolidate

after:

     1.08%           cc1  # libc-2.12.so                [.] _int_malloc
     0.94%           cc1  # kernel                      [k] clear_page_c
     0.74%           cc1  # libc-2.12.so                [.] _int_free
     0.69%           cc1  # kernel                      [k] page_fault
     0.46%           cc1  # libc-2.12.so                [.] malloc_consolidate

Would largely do the trick i think. The comments delineate the DSO portion from the task portion nicely - while also being a familar pattern. The column of [.] and [k] gives kernel developers a quick glance wrt. whether it's kernel or user-space - and it also delineates the symbol column from the DSO column.

Quoted 3 lines

Thanks,

Ingo

<random ideas for the future>

BTW, having [u] instead of [.] would perhaps be more clearer? And one day we might want to extend that with more granularity, like major contexts in uppercase: K=kernel, U=user, H=hypervisor and some minor in lowercase: h=hardirq, s=softirq, t=task.

So you can get [Kh], [Ks], etc...

User could then sort by context, which could be useful without callchains for example.

</random ideas for the future>