Date: Thu, 29 Jul 2021 15:25:30 GMT From: Mitchell Horne <mhorne@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 87c9a2933bdb - stable/13 - libpmc: make libpmc_pmu_utils.c more amenable to porting Message-ID: <202107291525.16TFPUoZ009964@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=87c9a2933bdb537cc163aaeb16e588d303dc1d50 commit 87c9a2933bdb537cc163aaeb16e588d303dc1d50 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2021-05-31 14:24:44 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2021-07-29 15:01:10 +0000 libpmc: make libpmc_pmu_utils.c more amenable to porting The current version has every function stubbed out for !x86. Only two functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platform dependent, so reduce the width of the ifdefs and remove some of the stubs. Reviewed by: ray MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30532 (cherry picked from commit 0024f1aa7720d5f4f587a6c5911fc5238195ae49) --- lib/libpmc/libpmc_pmu_util.c | 65 ++++++++------------------------------------ 1 file changed, 12 insertions(+), 53 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 90ce0feafa52..81320a3dc954 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -43,12 +43,12 @@ #include <libpmcstat.h> #include "pmu-events/pmu-events.h" -#if defined(__amd64__) || defined(__i386__) struct pmu_alias { const char *pa_alias; const char *pa_name; }; +#if defined(__amd64__) || defined(__i386__) typedef enum { PMU_INVALID, PMU_INTEL, @@ -139,6 +139,16 @@ pmu_alias_get(const char *name) return (name); } +#else + +static const char * +pmu_alias_get(const char *name) +{ + + return (name); +} +#endif + struct pmu_event_desc { uint64_t ped_period; uint64_t ped_offcore_rsp; @@ -417,6 +427,7 @@ pmc_pmu_print_counter_full(const char *ev) } } +#if defined(__amd64__) || defined(__i386__) static int pmc_pmu_amd_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, struct pmu_event_desc *ped) @@ -540,61 +551,9 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) #else -uint64_t -pmc_pmu_sample_rate_get(const char *event_name __unused) -{ - return (DEFAULT_SAMPLE_COUNT); -} - -void -pmc_pmu_print_counters(const char *event_name __unused) -{ -} - -void -pmc_pmu_print_counter_desc(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_desc_long(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_full(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 * -pmc_pmu_event_get_by_idx(const char *c __unused, int idx __unused) -{ - return (NULL); -} - -int -pmc_pmu_stat_mode(const char ***a __unused) -{ - return (EOPNOTSUPP); -} - -int -pmc_pmu_idx_get_by_event(const char *c __unused, const char *e __unused) -{ - return (-1); -} - #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107291525.16TFPUoZ009964>