lkml.org 
[lkml]   [2012]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/14] perf ui/hist: Add support for event group view
On Tue, Dec 18, 2012 at 04:47:10PM +0100, Jiri Olsa wrote:
> On Mon, Dec 17, 2012 at 03:38:58PM +0900, Namhyung Kim wrote:
> > From: Namhyung Kim <namhyung.kim@lge.com>
> >
> > Show group members' overhead also when showing the leader's if event
> > group is enabled. Use macro for defining hpp functions which looks
> > almost identical.
>
> SNIP
>
> > -
> > -static int hpp__color_overhead_us(struct perf_hpp_fmt *fmt __maybe_unused,
> > - struct perf_hpp *hpp, struct hist_entry *he)
> > +static int __hpp__percent_fmt(struct perf_hpp *hpp, struct hist_entry *he,
> > + u64 (*get_field)(struct hist_entry *),
> > + const char *fmt, hpp_snprint_fn print_fn)
>
> it's hard to tell from diff, but the function looks like this (group part):

Exactly.

>
> if (symbol_conf.event_group) {
> int prev_idx, idx_delta, i;
> struct perf_evsel *evsel = hists_to_evsel(hists);
> struct hist_entry *pair;
> int nr_members = evsel->nr_members;
>
> if (nr_members <= 1)
> return ret;
>
> prev_idx = perf_evsel__group_idx(evsel);
>
> list_for_each_entry(pair, &he->pairs.head, pairs.node) {
> u64 period = get_field(pair);
> u64 total = pair->hists->stats.total_period;
>
> if (!total)
> continue;
>
> evsel = hists_to_evsel(pair->hists);
> idx_delta = perf_evsel__group_idx(evsel) - prev_idx - 1;
>
> for (i = 0; i < idx_delta; i++) {
> ret += print_fn(hpp->buf + ret, hpp->size - ret,
> fmt, 0.0);
> }
>
> ret += print_fn(hpp->buf + ret, hpp->size - ret,
> fmt, 100.0 * period / total);
>
> prev_idx += 1 + idx_delta;
> }
>
> idx_delta = nr_members - prev_idx - 1;
>
> for (i = 0; i < idx_delta; i++) {
> ret += print_fn(hpp->buf + ret, hpp->size - ret,
> fmt, 0.0);
> }
> }
>
> The temporary array (initial send) was more clear to me.. but if
> this is the preffered way I wont object, since this is another place
> that would benefit from hist_entries array linking.. when (and if)
> there's ever patch for that ;-)
>
> I think this code now suffers from mischosen data layer

Yes, I admit that using array can make things simple. But I also don't
like a temporary array due to its runtime cost. Linking hist entries by
array can be a solution since it can be reused for output resorting and
(multiple) hpp column(s). In addition, it might have a smaller memory
footprint than the list method for the leader-only sample feature since
it'll make every hist entries to be linked IMHO.

Thanks,
Namhyung


\
 
 \ /
  Last update: 2012-12-20 04:41    [W:0.123 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site