Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
hwpmc : fix reload count when pmc has overflowed https://reviews.free…
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed Oct 1, 2019
1 parent 6299114 commit b390cbb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sys/dev/hwpmc/hwpmc_mod.c
Expand Up @@ -1619,7 +1619,7 @@ pmc_process_csw_out(struct thread *td)
pcd->pcd_read_pmc(cpu, adjri, &newvalue);

if (mode == PMC_MODE_TS) {
PMCDBG3(CSW,SWO,1,"cpu=%d ri=%d val=%jd (samp)",
PMCDBG3(CSW,SWO,2,"cpu=%d ri=%d val=%jd (samp)",
cpu, ri, newvalue);

if (pt == NULL)
Expand All @@ -1641,8 +1641,16 @@ pmc_process_csw_out(struct thread *td)
* once we have thoroughly tested that we
* don't hit the above assert.
*/
if (pt != NULL)
if (pt != NULL) {
pt->pt_pmcs[ri].pt_pmcval = newvalue;
/* If the pmc has overflowed
* reload the count discountung
* the overflow
* */
if (newvalue > pm->pm_sc.pm_reloadcount)
pt->pt_pmcs[ri].pt_pmcval +=
pm->pm_sc.pm_reloadcount;
}
else {
/*
* For sampling process-virtual PMCs,
Expand All @@ -1666,7 +1674,7 @@ pmc_process_csw_out(struct thread *td)
} else {
tmp = newvalue - PMC_PCPU_SAVED(cpu,ri);

PMCDBG3(CSW,SWO,1,"cpu=%d ri=%d tmp=%jd (count)",
PMCDBG3(CSW,SWO,2,"cpu=%d ri=%d tmp=%jd (count)",
cpu, ri, tmp);

/*
Expand Down

0 comments on commit b390cbb

Please sign in to comment.