Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Sep 2015 17:52:44 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287374 - head/usr.sbin/pmcstat
Message-ID:  <201509011752.t81HqiM6024257@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Sep  1 17:52:43 2015
New Revision: 287374
URL: https://svnweb.freebsd.org/changeset/base/287374

Log:
  Fix an off by one error in r283613:  Like regular ffs(), CPU_FFS() returns
  1 for CPU 0, etc. so the return value must be decremented to obtain the
  first valid CPU ID.
  
  Submitted by:	fabient
  MFC after:	1 week

Modified:
  head/usr.sbin/pmcstat/pmcstat.c

Modified: head/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat.c	Tue Sep  1 17:13:04 2015	(r287373)
+++ head/usr.sbin/pmcstat/pmcstat.c	Tue Sep  1 17:52:43 2015	(r287374)
@@ -769,7 +769,7 @@ main(int argc, char **argv)
 				ev->ev_count = -1;
 
 			if (option == 'S' || option == 's')
-				ev->ev_cpu = CPU_FFS(&cpumask);
+				ev->ev_cpu = CPU_FFS(&cpumask) - 1;
 			else
 				ev->ev_cpu = PMC_CPU_ANY;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509011752.t81HqiM6024257>