tools/perf/stat: Add perf stat --transaction

Add support to perf stat to print the basic transactional execution statistics:
Total cycles, Cycles in Transaction, Cycles in aborted transsactions
using the in_tx and in_tx_checkpoint qualifiers.
Transaction Starts and Elision Starts, to compute the average transaction
length.

This is a reasonable overview over the success of the transactions.

Also support architectures that have a transaction aborted cycles
counter like POWER8. Since that is awkward to handle in the kernel
abstract handle both cases here.

Enable with a new --transaction / -T option.

This requires measuring these events in a group, since they depend on each
other.

This is implemented by using TM sysfs events exported by the kernel

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Arnaldo Carvalho de Melo <acme@infradead.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1377128846-977-5-git-send-email-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Andi Kleen 2013-08-21 16:47:26 -07:00 committed by Ingo Molnar
parent 723478c8a4
commit 4cabc3d1cb
5 changed files with 171 additions and 1 deletions

View file

@ -637,3 +637,19 @@ void print_pmu_events(const char *event_glob, bool name_only)
printf("\n");
free(aliases);
}
bool pmu_have_event(const char *pname, const char *name)
{
struct perf_pmu *pmu;
struct perf_pmu_alias *alias;
pmu = NULL;
while ((pmu = perf_pmu__scan(pmu)) != NULL) {
if (strcmp(pname, pmu->name))
continue;
list_for_each_entry(alias, &pmu->aliases, list)
if (!strcmp(alias->name, name))
return true;
}
return false;
}