[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151221083607.GA22464@danjae.kornet>
Date: Mon, 21 Dec 2015 17:36:07 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
David Ahern <dsahern@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Andi Kleen <andi@...stfloor.org>,
Wang Nan <wangnan0@...wei.com>
Subject: Re: [PATCH 06/10] perf tools: Try to show pretty printed output for
dynamic sort keys
Hi Jiri,
On Sun, Dec 20, 2015 at 03:12:45PM +0100, Jiri Olsa wrote:
> On Wed, Dec 16, 2015 at 12:35:39AM +0900, Namhyung Kim wrote:
>
> SNIP
>
> > struct trace_seq seq;
> > + char *str, *pos;
> > + struct format_field *field;
> > + struct pevent_record rec = {
> > + .cpu = he->cpu,
> > + .data = he->raw_data,
> > + .size = he->raw_size,
> > + };
> > + size_t namelen;
> > int ret;
> >
> > hde = container_of(fmt, struct hpp_dynamic_entry, hpp);
> > @@ -1605,9 +1654,28 @@ static int __sort__hde_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
> > if (hists_to_evsel(he->hists) != hde->evsel)
> > return scnprintf(hpp->buf, hpp->size, "%*.*s", len, len, "N/A");
> >
> > + field = hde->field;
> > trace_seq_init(&seq);
> > - print_event_field(&seq, he->raw_data, hde->field);
> > - ret = scnprintf(hpp->buf, hpp->size, "%*.*s", len, len, seq.buffer);
> > + pevent_event_info(&seq, field->event, &rec);
>
> hm, maybe we could cache the seq.buffer data in hist_entry?
>
> IIRC pevent_event_info code does a lot of stuff, so
> it might be better to call it just once.. caching
> its results in hist_entry seems like small price
Right. I did the same thing for 'trace' sort key, so will move it to
here.
Thanks,
Namhyung
>
> > +
> > + namelen = strlen(field->name);
> > + str = strtok_r(seq.buffer, " ", &pos);
> > + while (str) {
> > + if (!strncmp(str, field->name, namelen)) {
> > + str += namelen + 1;
> > + break;
> > + }
> > +
> > + str = strtok_r(NULL, " ", &pos);
> > + }
> > +
>
> SNIP
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists