Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/pmc/cmd_pmc_stat.c
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | pmc_stat_setup_stat(int system_mode, const char *arg) | ||||
cpuset_t cpumask, rootmask; | cpuset_t cpumask, rootmask; | ||||
if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, | if (cpuset_getaffinity(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, | ||||
sizeof(rootmask), &rootmask) == -1) | sizeof(rootmask), &rootmask) == -1) | ||||
err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); | err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); | ||||
CPU_COPY(&rootmask, &cpumask); | CPU_COPY(&rootmask, &cpumask); | ||||
if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0) | if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0) | ||||
errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host."); | errx(EX_USAGE, "ERROR: hwpmc.ko not loaded or stat not supported on host."); | ||||
if (system_mode && geteuid() != 0) | if (system_mode && geteuid() != 0) | ||||
errx(EX_USAGE, "ERROR: system mode counters can only be used as root"); | errx(EX_USAGE, "ERROR: system mode counters can only be used as root"); | ||||
counters = NULL; | counters = NULL; | ||||
for (i = 0; i < STAT_MODE_NPMCS; i++) { | for (i = 0; i < STAT_MODE_NPMCS; i++) { | ||||
stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i]; | stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i]; | ||||
stat_mode_names[i] = pmc_stat_mode_names[i]; | stat_mode_names[i] = pmc_stat_mode_names[i]; | ||||
} | } | ||||
if (arg) { | if (arg) { | ||||
▲ Show 20 Lines • Show All 313 Lines • Show Last 20 Lines |