Re: [PATCH 4/4] perf, tools: Add perf stat --transaction v3

From: Andi Kleen
Date: Thu Aug 15 2013 - 10:06:40 EST


> > +/* Default events used for perf stat -T */
> > +static const char * const transaction_attrs[] = {
> > + "task-clock",
> > + "{"
> > + "instructions,"
> > + "cycles,"
> > + "cpu/cycles-t/,"
> > + "cpu/tx-start/,"
> > + "cpu/el-start/,"
> > + "cpu/cycles-ct/"
> > + "}"
> > +};
> > +
> > +/* More limited version when the CPU does not have all events. */
> > +static const char * const transaction_limited_attrs[] = {
> > + "task-clock",
> > + "{"
> > + "instructions,"
> > + "cycles,"
> > + "cpu/cycles-t/,"
> > + "cpu/tx-start/"
> > + "}"
> > +};
> > +
> > +/* must match the transaction_attrs above */
>
> Match in what way? It kinda matches the first one (transaction_attrs):

The second is just the beginning of the first.

The { } don't count for matches.

For the limited run the comparisons of the elements that are not there
fail.

>
> enum {
> T_TASK_CLOCK, == "task-clock",
> T_INSTRUCTIONS, == "instructions,"
> T_CYCLES, == "cycles,"
> T_CYCLES_IN_TX, ~= "cpu/cycles-t/,"
> T_TRANSACTION_START, != "cpu/tx-start/,"
> T_ELISION_START, ~= "cpu/el-start/,"
> T_CYCLES_IN_TX_CP, != "cpu/cycles-ct/"
> };

I did a quick test of the fallback path by manually disabling the events,
and it seemed to work, but it's really for POWER based on Michael E's feedback.

>
> Also the enum numbers won't match the array positions due to the '{'
> grouping (?) entries, so, without looking further, how can this match?
> Reading on...

The match is on the result array. The results don't contain the { }
as individual elements.

Anyways I use this option pretty heavily and the results are good
to my knowledge.

-Andi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/