aboutsummaryrefslogtreecommitdiff
path: root/lib/libpmc
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-03-11 19:29:45 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-03-11 19:29:45 +0000
commit6bb7ba4aa180f667c1b558de1fc364f41bab57ce (patch)
treea20f8deada6b0e49042cb54feb394af82ae55a48 /lib/libpmc
parent456d57a66d54dd365736536482660de99cf94a04 (diff)
Diffstat (limited to 'lib/libpmc')
-rw-r--r--lib/libpmc/libpmc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index ea0539d2225a..d01f88bdaff7 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -763,13 +763,20 @@ static struct pmc_event_alias cortex_a57_aliases[] = {
static struct pmc_event_alias cortex_a76_aliases[] = {
EV_ALIAS(NULL, NULL)
};
+
static int
-arm64_allocate_pmc(enum pmc_event pe, char *ctrspec __unused,
- struct pmc_op_pmcallocate *pmc_config __unused)
+arm64_allocate_pmc(enum pmc_event pe, char *ctrspec,
+ struct pmc_op_pmcallocate *pmc_config)
{
- switch (pe) {
- default:
- break;
+ char *p;
+
+ while ((p = strsep(&ctrspec, ",")) != NULL) {
+ if (KWMATCH(p, "os"))
+ pmc_config->pm_caps |= PMC_CAP_SYSTEM;
+ else if (KWMATCH(p, "usr"))
+ pmc_config->pm_caps |= PMC_CAP_USER;
+ else
+ return (-1);
}
return (0);