summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pmcstat
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2008-10-07 17:28:52 +0000
committerjkoshy <jkoshy@FreeBSD.org>2008-10-07 17:28:52 +0000
commitde3502c94653a61f09be8b8db9619c0b03d1964c (patch)
treed96073a1f6693ee08ef3c93c2fcbc751d114a749 /usr.sbin/pmcstat
parent74de8ad739e009becd2edda61ec8ebc54b8fac13 (diff)
downloadFreeBSD-src-de3502c94653a61f09be8b8db9619c0b03d1964c.zip
FreeBSD-src-de3502c94653a61f09be8b8db9619c0b03d1964c.tar.gz
- Avoid a spurious error when a command line is specified without
any process scope PMCs. - Change the -c '*' option to denote non-halted CPUs.
Diffstat (limited to 'usr.sbin/pmcstat')
-rw-r--r--usr.sbin/pmcstat/pmcstat.86
-rw-r--r--usr.sbin/pmcstat/pmcstat.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/pmcstat/pmcstat.8 b/usr.sbin/pmcstat/pmcstat.8
index 7361ceb..f0a3a47 100644
--- a/usr.sbin/pmcstat/pmcstat.8
+++ b/usr.sbin/pmcstat/pmcstat.8
@@ -209,9 +209,9 @@ Argument
.Ar cpu-spec
is a comma separated list of CPU numbers, or the literal
.Sq *
-denoting all CPUs.
-The default is to allocate system mode PMCs on all active CPUs in
-the system.
+denoting all unhalted CPUs.
+The default is to allocate system mode PMCs on all unhalted
+CPUs.
.It Fl d
Toggle between process mode PMCs measuring events for the target
process' current and future children or only measuring events for
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
index 0e9a54a..8cbe55b 100644
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -581,6 +581,7 @@ main(int argc, char **argv)
if (sysctlbyname("hw.ncpu", &ncpu, &dummy, NULL, 0) < 0)
err(EX_OSERR, "ERROR: Cannot determine the number of CPUs");
cpumask = (1 << ncpu) - 1;
+ haltedcpus = 0;
if (ncpu > 1) {
if (sysctlbyname("machdep.hlt_cpus", &haltedcpus, &dummy,
NULL, 0) < 0)
@@ -600,7 +601,7 @@ main(int argc, char **argv)
case 'c': /* CPU */
if (optarg[0] == '*' && optarg[1] == '\0')
- cpumask = (1 << ncpu) - 1;
+ cpumask = ((1 << ncpu) - 1) & ~haltedcpus;
else
cpumask = pmcstat_get_cpumask(optarg);
@@ -1149,7 +1150,7 @@ main(int argc, char **argv)
if (SLIST_EMPTY(&args.pa_targets))
errx(EX_DATAERR, "ERROR: No matching target "
"processes.");
- else
+ if (args.pa_flags & FLAG_HAS_PROCESS_PMCS)
pmcstat_attach_pmcs(&args);
if (pmcstat_kvm) {
OpenPOWER on IntegriCloud