As a matter of good programming style, stop PMCs before releasing

them.
This commit is contained in:
Joseph Koshy 2008-11-19 02:22:34 +00:00
parent de3a91a092
commit b8fbd97b35
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185079

View File

@ -145,6 +145,9 @@ pmcstat_cleanup(struct pmcstat_args *a)
/* release allocated PMCs. */
STAILQ_FOREACH_SAFE(ev, &a->pa_events, ev_next, tmp)
if (ev->ev_pmcid != PMC_ID_INVALID) {
if (pmc_stop(ev->ev_pmcid) < 0)
err(EX_OSERR, "ERROR: cannot stop pmc 0x%x "
"\"%s\"", ev->ev_pmcid, ev->ev_name);
if (pmc_release(ev->ev_pmcid) < 0)
err(EX_OSERR, "ERROR: cannot release pmc "
"0x%x \"%s\"", ev->ev_pmcid, ev->ev_name);