lkml.org 
[lkml]   [2015]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 06/10] perf tools: Try to show pretty printed output for dynamic sort keys
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

jirka

> +
> + 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



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