aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2013-08-21 19:47:26 -0400
committerIngo Molnar <mingo@kernel.org>2013-10-04 04:06:07 -0400
commit4cabc3d1cb6a46f581a2628d1d11c483d5f300e5 (patch)
tree5daa1d88dd0cfa62433f7d6149f5f96c6a3fc33d /tools/perf/util
parent723478c8a471403c53cf144999701f6e0c4bbd11 (diff)
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>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/evsel.h6
-rw-r--r--tools/perf/util/pmu.c16
-rw-r--r--tools/perf/util/pmu.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 4a7bdc713bab..5aa68cddc7d9 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -197,6 +197,12 @@ static inline bool perf_evsel__match2(struct perf_evsel *e1,
197 (e1->attr.config == e2->attr.config); 197 (e1->attr.config == e2->attr.config);
198} 198}
199 199
200#define perf_evsel__cmp(a, b) \
201 ((a) && \
202 (b) && \
203 (a)->attr.type == (b)->attr.type && \
204 (a)->attr.config == (b)->attr.config)
205
200int __perf_evsel__read_on_cpu(struct perf_evsel *evsel, 206int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
201 int cpu, int thread, bool scale); 207 int cpu, int thread, bool scale);
202 208
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index bc9d8069d376..64362fe45b71 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -637,3 +637,19 @@ void print_pmu_events(const char *event_glob, bool name_only)
637 printf("\n"); 637 printf("\n");
638 free(aliases); 638 free(aliases);
639} 639}
640
641bool pmu_have_event(const char *pname, const char *name)
642{
643 struct perf_pmu *pmu;
644 struct perf_pmu_alias *alias;
645
646 pmu = NULL;
647 while ((pmu = perf_pmu__scan(pmu)) != NULL) {
648 if (strcmp(pname, pmu->name))
649 continue;
650 list_for_each_entry(alias, &pmu->aliases, list)
651 if (!strcmp(alias->name, name))
652 return true;
653 }
654 return false;
655}
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 6b2cbe2d4cc3..1179b26f244a 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -42,6 +42,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head);
42struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); 42struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
43 43
44void print_pmu_events(const char *event_glob, bool name_only); 44void print_pmu_events(const char *event_glob, bool name_only);
45bool pmu_have_event(const char *pname, const char *name);
45 46
46int perf_pmu__test(void); 47int perf_pmu__test(void);
47#endif /* __PMU_H */ 48#endif /* __PMU_H */