Index: usr.sbin/pmcstat/pmcstat.c =================================================================== --- usr.sbin/pmcstat/pmcstat.c +++ usr.sbin/pmcstat/pmcstat.c @@ -119,6 +119,9 @@ struct pmcstat_args args; static bool libpmc_initialized = false; +/* Allow for a 3 digit CPU ID */ +#define PMC_CPU_WIDTH 3 + static void pmcstat_get_cpumask(const char *cpuspec, cpuset_t *cpumask) { @@ -288,8 +291,9 @@ w = ev->ev_fieldwidth - ev->ev_fieldskip - 2; if (c == 's') - (void) fprintf(args.pa_printfile, "s/%02d/%-*s ", - ev->ev_cpu, w-3, ev->ev_name); + (void) fprintf(args.pa_printfile, + "s/%0"__XSTRING(PMC_CPU_WIDTH)"d/%-*s ", + ev->ev_cpu, w - PMC_CPU_WIDTH - 1, ev->ev_name); else (void) fprintf(args.pa_printfile, "p/%*s ", w, ev->ev_name); @@ -1213,7 +1217,8 @@ display_width = (int) floor(counter_width / 3.32193) + 1; if (PMC_IS_SYSTEM_MODE(ev->ev_mode)) - header_width += 3; /* 2 digit CPU number + '/' */ + /* CPU number + '/' */ + header_width += PMC_CPU_WIDTH + 1; if (header_width > display_width) { ev->ev_fieldskip = 0;