diff options
author | Matt Macy <mmacy@FreeBSD.org> | 2018-05-29 04:23:16 +0000 |
---|---|---|
committer | Matt Macy <mmacy@FreeBSD.org> | 2018-05-29 04:23:16 +0000 |
commit | 78beed2f81190780df6b7ab24af675e198d65de5 (patch) | |
tree | 1faa3f86ec03c63ab2452cbfb83f581d00abfc72 | |
parent | 23c01e5b572330d9baec5d6e236d6021373a0fe8 (diff) |
Notes
-rw-r--r-- | lib/libpmc/libpmc_pmu_util.c | 26 | ||||
-rw-r--r-- | lib/libpmc/pmc.h | 3 | ||||
-rw-r--r-- | lib/libpmc/pmclog.c | 2 |
3 files changed, 27 insertions, 4 deletions
diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index c2ac3b9e931a5..6d0bd3793f94a 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -131,7 +131,7 @@ pmu_event_get(const char *event_name, int *idx) } const char * -pmu_event_get_by_idx(int idx) +pmc_pmu_event_get_by_idx(int idx) { const struct pmu_events_map *pme; const struct pmu_event *pe; @@ -321,6 +321,27 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (0); } +/* + * Ultimately rely on AMD calling theirs the same + */ +static const char *stat_mode_cntrs[] = { + "inst_retired.any", + "cpu_clk_unhalted.thread_p_any", + "br_inst_retired.all_branches", + "br_misp_retired.all_branches", + "cpu_clk_unhalted.thread_p_any" +}; + +int +pmc_pmu_stat_mode(const char ***cntrs) +{ + if (pmc_pmu_enabled()) { + *cntrs = stat_mode_cntrs; + return (0); + } + return (EOPNOTSUPP); +} + #else uint64_t pmc_pmu_sample_rate_get(const char *event_name __unused) { return (DEFAULT_SAMPLE_COUNT); } void pmc_pmu_print_counters(void) {} @@ -328,6 +349,7 @@ void pmc_pmu_print_counter_desc(const char *e __unused) {} void pmc_pmu_print_counter_desc_long(const char *e __unused) {} int pmc_pmu_enabled(void) { return (0); } int pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) { return (EOPNOTSUPP); } -const char *pmu_event_get_by_idx(int idx __unused) { return (NULL); } +const char *pmc_pmu_event_get_by_idx(int idx __unused) { return (NULL); } +int pmc_pmu_stat_mode(const char ***a __unused) { return (EOPNOTSUPP); } #endif diff --git a/lib/libpmc/pmc.h b/lib/libpmc/pmc.h index 3a72930b9e1d7..b128029713a13 100644 --- a/lib/libpmc/pmc.h +++ b/lib/libpmc/pmc.h @@ -119,7 +119,8 @@ void pmc_pmu_print_counter_desc(const char *); void pmc_pmu_print_counter_desc_long(const char *); uint64_t pmc_pmu_sample_rate_get(const char *); int pmc_pmu_pmcallocate(const char *, struct pmc_op_pmcallocate *); -const char *pmu_event_get_by_idx(int idx); +const char *pmc_pmu_event_get_by_idx(int idx); +int pmc_pmu_stat_mode(const char ***); __END_DECLS #endif diff --git a/lib/libpmc/pmclog.c b/lib/libpmc/pmclog.c index 8e0504b290f23..ff0a9d5fdb794 100644 --- a/lib/libpmc/pmclog.c +++ b/lib/libpmc/pmclog.c @@ -368,7 +368,7 @@ pmclog_get_event(void *cookie, char **data, ssize_t *len, PMCLOG_READ32(le,ev->pl_u.pl_a.pl_event); PMCLOG_READ32(le,ev->pl_u.pl_a.pl_flags); PMCLOG_READ32(le,noop); - ev->pl_u.pl_a.pl_evname = pmu_event_get_by_idx(ev->pl_u.pl_a.pl_event); + ev->pl_u.pl_a.pl_evname = pmc_pmu_event_get_by_idx(ev->pl_u.pl_a.pl_event); if (ev->pl_u.pl_a.pl_evname != NULL) break; else if ((ev->pl_u.pl_a.pl_evname = |