1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

pmccontrol: improve -L with pmu-events

Check if the pmu utils are supported rather than carrying a
machine-dependent #ifdef.

Reviewed by:	gnn, ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30526
This commit is contained in:
Mitchell Horne 2021-05-31 11:14:36 -03:00
parent 0092642f86
commit 167cdaa7e3

View File

@ -282,14 +282,6 @@ pmcc_do_list_state(void)
return 0; return 0;
} }
#if defined(__i386__) || defined(__amd64__)
static int
pmcc_do_list_events(void)
{
pmc_pmu_print_counters(NULL);
return (0);
}
#else
static int static int
pmcc_do_list_events(void) pmcc_do_list_events(void)
{ {
@ -298,6 +290,13 @@ pmcc_do_list_events(void)
const char **eventnamelist; const char **eventnamelist;
const struct pmc_cpuinfo *ci; const struct pmc_cpuinfo *ci;
/* First, try pmu events. */
if (pmc_pmu_enabled()) {
pmc_pmu_print_counters(NULL);
return (0);
}
/* Otherwise, use the legacy pmc(3) interfaces. */
if (pmc_cpuinfo(&ci) != 0) if (pmc_cpuinfo(&ci) != 0)
err(EX_OSERR, "Unable to determine CPU information"); err(EX_OSERR, "Unable to determine CPU information");
@ -319,7 +318,6 @@ pmcc_do_list_events(void)
} }
return 0; return 0;
} }
#endif
static int static int
pmcc_show_statistics(void) pmcc_show_statistics(void)