lkml.org 
[lkml]   [2012]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf report: Add a simple GTK2-based 'perf report' browser
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-02-23 17:31    [W:0.062 / U:34.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site