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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to