Date: Tue, 29 May 2018 04:23:16 +0000 (UTC) From: Matt Macy <mmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334312 - head/lib/libpmc Message-ID: <201805290423.w4T4NGLw059016@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mmacy Date: Tue May 29 04:23:16 2018 New Revision: 334312 URL: https://svnweb.freebsd.org/changeset/base/334312 Log: libpmc: export names of counters for stat mode, make get_by_idx name consistent with others Modified: head/lib/libpmc/libpmc_pmu_util.c (contents, props changed) head/lib/libpmc/pmc.h head/lib/libpmc/pmclog.c Modified: head/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- head/lib/libpmc/libpmc_pmu_util.c Tue May 29 04:04:06 2018 (r334311) +++ head/lib/libpmc/libpmc_pmu_util.c Tue May 29 04:23:16 2018 (r334312) @@ -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 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 Modified: head/lib/libpmc/pmc.h ============================================================================== --- head/lib/libpmc/pmc.h Tue May 29 04:04:06 2018 (r334311) +++ head/lib/libpmc/pmc.h Tue May 29 04:23:16 2018 (r334312) @@ -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 Modified: head/lib/libpmc/pmclog.c ============================================================================== --- head/lib/libpmc/pmclog.c Tue May 29 04:04:06 2018 (r334311) +++ head/lib/libpmc/pmclog.c Tue May 29 04:23:16 2018 (r334312) @@ -368,7 +368,7 @@ pmclog_get_event(void *cookie, char **data, ssize_t *l 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 =
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805290423.w4T4NGLw059016>