Messages in this thread | | | Date | Mon, 21 Dec 2015 17:36:07 +0900 | From | Namhyung Kim <> | 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 >
| |