lkml.org 
[lkml]   [2012]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] perf report: Add a simple GTK2-based 'perf report' browser
From
On Thu, Feb 23, 2012 at 6:28 PM, Arnaldo Carvalho de Melo
<acme@ghostprotocols.net> wrote:
> 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?

Dunno, probably. Does that matter, though? It's pretty damn fast as-is.

Pekka
--
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:35    [from the cache]
©2003-2011 Jasper Spaans