forked from M-Labs/artiq
pcu: refactor into a device
This commit is contained in:
parent
b05d1bb7e3
commit
e323e37829
|
@ -31,8 +31,13 @@ def _PCMR(n):
|
|||
return _SPRGROUP_PC + 8 + n
|
||||
|
||||
|
||||
@kernel
|
||||
def pc_start():
|
||||
class CorePCU:
|
||||
"""Core device performance counter unit (PCU) access"""
|
||||
def __init__(self, dmgr, core_device="core"):
|
||||
self.core = dmgr.get(core_device)
|
||||
|
||||
@kernel
|
||||
def start(self):
|
||||
"""
|
||||
Configure and clear the kernel CPU performance counters.
|
||||
|
||||
|
@ -60,11 +65,11 @@ def pc_start():
|
|||
mtspr(_PCMR(6), _SPR_PCMR_CISM | _SPR_PCMR_BS)
|
||||
mtspr(_PCMR(7), _SPR_PCMR_CISM | _SPR_PCMR_DDS)
|
||||
|
||||
|
||||
@kernel
|
||||
def pc_get(r):
|
||||
@kernel
|
||||
def get(self, r):
|
||||
"""
|
||||
Read the performance counters and store the counts in the array provided.
|
||||
Read the performance counters and store the counts in the
|
||||
array provided.
|
||||
|
||||
:param list[int] r: array to store the counter values
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue