aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pmcstat
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2021-04-21 20:28:12 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2021-04-29 13:19:20 +0000
commit112e30301846d8fede4679a3f95e18820d721bbd (patch)
treeadf2f84abb0b1b61ead3c6f1320a2db3968a56fe /usr.sbin/pmcstat
parente0ae2b39aa3e51b0e3f7b9661192cba8f06e7b10 (diff)
downloadsrc-112e30301846d8fede4679a3f95e18820d721bbd.tar.gz
src-112e30301846d8fede4679a3f95e18820d721bbd.zip
pmcstat: set initial counter value to zero
For an infrequent event, pmcstat may report (u_long)-1 for CPUs where the counter was never incremented. Just set this to zero, instead. ev->ev_count is passed as the 'count' argument to pmc_allocate(3), but this wasn't always the case. Reviewed by: gnn MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29887 (cherry picked from commit edcf9e59c356525632dd2546d72916aeca609a2b)
Diffstat (limited to 'usr.sbin/pmcstat')
-rw-r--r--usr.sbin/pmcstat/pmcstat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
index 688a98843652..b7f6c5e0f63e 100644
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -675,7 +675,7 @@ main(int argc, char **argv)
if (option == 'S' || option == 'P')
ev->ev_count = current_sampling_count ? current_sampling_count : pmc_pmu_sample_rate_get(ev->ev_spec);
else
- ev->ev_count = -1;
+ ev->ev_count = 0;
if (option == 'S' || option == 's')
ev->ev_cpu = CPU_FFS(&cpumask) - 1;