linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Pekka Enberg <penberg@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] perf report: Add a simple GTK2-based 'perf report' browser
Date: Thu, 23 Feb 2012 14:28:50 -0200	[thread overview]
Message-ID: <20120223162850.GC25177@infradead.org> (raw)
In-Reply-To: <1330013922-3332-1-git-send-email-penberg@kernel.org>

Em Thu, Feb 23, 2012 at 06:18:42PM +0200, Pekka Enberg escreveu:
> This patch adds a simple GTK2-based browser to 'perf report' that's based on
> the TTY-based browser in builtin-report.c.
> 
> Please not that you need to use
> 
>   make WERROR=0
> 
> to build perf on Fedora 15 (and possibly other distributions) because GTK
> headers do not compile cleanly:
> 
>       CC util/gtk/browser.o
>   In file included from /usr/include/gtk-2.0/gtk/gtk.h:234:0,
>                    from util/gtk/browser.c:7:
>   /usr/include/gtk-2.0/gtk/gtkitemfactory.h:47:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
> 
> To launch "perf report" using the new GTK interface just type:
> 
>   ./perf report --gtk
> 
> The interface is somewhat limited in features at the moment:
> 
>   - No callgraph support
> 
>   - No KVM guest profiling support
> 
>   - No color coding for percentages
> 
>   - No sorting from the UI
> 
>   - ..and many, many more!
> 
> That said, I think this patch a reasonable start to build future features on.

<SNIP>

> +	for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
> +		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
> +		GtkTreeIter iter;
> +		double percent;
> +		char s[512];
> +
> +		if (h->filtered)
> +			continue;
> +
> +		gtk_list_store_append(store, &iter);
> +
> +		col_idx = 0;
> +
> +		percent = (h->period * 100.0) / total_period;
> +
> +		snprintf(s, ARRAY_SIZE(s), "%.2f", percent);
> +
> +		gtk_list_store_set(store, &iter, col_idx++, s, -1);
> +
> +		list_for_each_entry(se, &hist_entry__sort_list, list) {
> +			if (se->elide)
> +				continue;
> +
> +			se->se_snprintf(h, s, ARRAY_SIZE(s),
> +					hists__col_len(hists, se->se_width_idx));
> +
> +			gtk_list_store_set(store, &iter, col_idx++, s, -1);
> +		}
> +	}

This is what I avoided by writing a tree widget for the TUI, I really
didn't want to traverse _all_ the hists just to show the ones that
appear in the screen.

Isn't there a way to ask GTK to ask a callback to provide a
representation for the Nth hist entry, i.e. just the ones it _needs_ to
render the screen?

Anyway, great to see this work!

- Arnaldo

  reply	other threads:[~2012-02-23 16:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23 16:18 [PATCH] perf report: Add a simple GTK2-based 'perf report' browser Pekka Enberg
2012-02-23 16:28 ` Arnaldo Carvalho de Melo [this message]
2012-02-23 16:32   ` Pekka Enberg
2012-02-23 16:39     ` Arnaldo Carvalho de Melo
2012-02-23 16:45       ` Pekka Enberg
2012-02-23 16:47         ` Arnaldo Carvalho de Melo
2012-02-23 16:53           ` Arnaldo Carvalho de Melo
2012-02-23 17:10             ` Pekka Enberg
2012-02-23 17:37               ` Arnaldo Carvalho de Melo
2012-02-23 17:52                 ` Pekka Enberg
2012-02-24  0:58                   ` Namhyung Kim
2012-02-24  6:36                     ` Pekka Enberg
2012-03-19 20:08                   ` [tip:perf/core] " tip-bot for Pekka Enberg
2012-02-23 19:36 ` [PATCH] " Colin Walters
2012-02-23 20:18   ` Pekka Enberg
2012-02-23 20:33     ` Colin Walters
2012-02-23 21:27       ` Pekka Enberg
2012-02-24  9:48         ` Ingo Molnar
2012-02-24 10:05           ` Pekka Enberg
2012-03-16 19:48             ` Arnaldo Carvalho de Melo
2012-03-19 18:12             ` Arnaldo Carvalho de Melo
2012-03-27 10:26               ` Pekka Enberg

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=20120223162850.GC25177@infradead.org \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=penberg@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).