forked from M-Labs/artiq
1
0
Fork 0

pcu: refactor into a device

This commit is contained in:
Robert Jördens 2017-02-19 19:31:28 +01:00
parent b05d1bb7e3
commit e323e37829
1 changed files with 40 additions and 35 deletions

View File

@ -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
"""