Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/pmccontrol/pmccontrol.c
Show First 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | for (n = 0; n < npmc; n++) { | ||||
} | } | ||||
printf("\n"); | printf("\n"); | ||||
} | } | ||||
free(pi); | free(pi); | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
#if defined(__i386__) || defined(__amd64__) | |||||
static int | static int | ||||
pmcc_do_list_events(void) | pmcc_do_list_events(void) | ||||
{ | { | ||||
pmc_pmu_print_counters(NULL); | |||||
return (0); | |||||
} | |||||
#else | |||||
static int | |||||
pmcc_do_list_events(void) | |||||
{ | |||||
enum pmc_class c; | enum pmc_class c; | ||||
unsigned int i, j, nevents; | unsigned int i, j, nevents; | ||||
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); | |||||
emaste: This (`pmc_pmu_print_counters`) is an empty fn on non-x86? | |||||
Done Inline ActionsFor now, yes, but soon it won't be. However, pmc_pmu_enabled() will return false on those platforms. mhorne: For now, yes, but soon it won't be. However, `pmc_pmu_enabled()` will return false on those… | |||||
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"); | ||||
eventnamelist = NULL; | eventnamelist = NULL; | ||||
for (i = 0; i < ci->pm_nclass; i++) { | for (i = 0; i < ci->pm_nclass; i++) { | ||||
c = ci->pm_classes[i].pm_class; | c = ci->pm_classes[i].pm_class; | ||||
printf("%s\n", pmc_name_of_class(c)); | printf("%s\n", pmc_name_of_class(c)); | ||||
if (pmc_event_names_of_class(c, &eventnamelist, &nevents) < 0) | if (pmc_event_names_of_class(c, &eventnamelist, &nevents) < 0) | ||||
err(EX_OSERR, | err(EX_OSERR, | ||||
"ERROR: Cannot find information for event class \"%s\"", | "ERROR: Cannot find information for event class \"%s\"", | ||||
pmc_name_of_class(c)); | pmc_name_of_class(c)); | ||||
for (j = 0; j < nevents; j++) | for (j = 0; j < nevents; j++) | ||||
printf("\t%s\n", eventnamelist[j]); | printf("\t%s\n", eventnamelist[j]); | ||||
free(eventnamelist); | free(eventnamelist); | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
#endif | |||||
static int | static int | ||||
pmcc_show_statistics(void) | pmcc_show_statistics(void) | ||||
{ | { | ||||
struct pmc_driverstats gms; | struct pmc_driverstats gms; | ||||
if (pmc_get_driver_stats(&gms) < 0) | if (pmc_get_driver_stats(&gms) < 0) | ||||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |
This (pmc_pmu_print_counters) is an empty fn on non-x86?