lkml.org 
[lkml]   [2018]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] perf script: Enhance sample flags for trace begin / end
Em Wed, Sep 19, 2018 at 03:45:56PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Sep 19, 2018 at 02:23:33PM +0300, Adrian Hunter escreveu:
> > Allow for different combinations of sample flags with "trace begin" or
> > "trace end".
>
> Please describe how you would use this with some command and its output.

This is another case where we have to apply these patches to then, at
the last patch see the result of it, isn't it possible to help people
not deep into intel-pt to figure, patch by patch, how these patches help
in achieving what you want at the last patch?

- Arnaldo

> - Arnaldo
>
> > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> > ---
> > tools/perf/builtin-script.c | 36 +++++++++++++++++++++++++++---------
> > 1 file changed, 27 insertions(+), 9 deletions(-)
> >
> > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> > index 6176bae177c2..4982380ba96d 100644
> > --- a/tools/perf/builtin-script.c
> > +++ b/tools/perf/builtin-script.c
> > @@ -1255,6 +1255,18 @@ static struct {
> > {0, NULL}
> > };
> >
> > +static const char *sample_flags_to_name(u32 flags)
> > +{
> > + int i;
> > +
> > + for (i = 0; sample_flags[i].name ; i++) {
> > + if (sample_flags[i].flags == flags)
> > + return sample_flags[i].name;
> > + }
> > +
> > + return NULL;
> > +}
> > +
> > static int perf_sample__fprintf_flags(u32 flags, FILE *fp)
> > {
> > const char *chars = PERF_IP_FLAG_CHARS;
> > @@ -1264,11 +1276,20 @@ static int perf_sample__fprintf_flags(u32 flags, FILE *fp)
> > char str[33];
> > int i, pos = 0;
> >
> > - for (i = 0; sample_flags[i].name ; i++) {
> > - if (sample_flags[i].flags == (flags & ~PERF_IP_FLAG_IN_TX)) {
> > - name = sample_flags[i].name;
> > - break;
> > - }
> > + name = sample_flags_to_name(flags & ~PERF_IP_FLAG_IN_TX);
> > + if (name)
> > + return fprintf(fp, " %-15s%4s ", name, in_tx ? "(x)" : "");
> > +
> > + if (flags & PERF_IP_FLAG_TRACE_BEGIN) {
> > + name = sample_flags_to_name(flags & ~(PERF_IP_FLAG_IN_TX | PERF_IP_FLAG_TRACE_BEGIN));
> > + if (name)
> > + return fprintf(fp, " tr strt %-7s%4s ", name, in_tx ? "(x)" : "");
> > + }
> > +
> > + if (flags & PERF_IP_FLAG_TRACE_END) {
> > + name = sample_flags_to_name(flags & ~(PERF_IP_FLAG_IN_TX | PERF_IP_FLAG_TRACE_END));
> > + if (name)
> > + return fprintf(fp, " tr end %-7s%4s ", name, in_tx ? "(x)" : "");
> > }
> >
> > for (i = 0; i < n; i++, flags >>= 1) {
> > @@ -1281,10 +1302,7 @@ static int perf_sample__fprintf_flags(u32 flags, FILE *fp)
> > }
> > str[pos] = 0;
> >
> > - if (name)
> > - return fprintf(fp, " %-7s%4s ", name, in_tx ? "(x)" : "");
> > -
> > - return fprintf(fp, " %-11s ", str);
> > + return fprintf(fp, " %-19s ", str);
> > }
> >
> > struct printer_data {
> > --
> > 2.17.1

\
 
 \ /
  Last update: 2018-09-19 20:48    [W:0.057 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site