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

View File

@ -31,8 +31,13 @@ def _PCMR(n):
return _SPRGROUP_PC + 8 + n
class CorePCU:
"""Core device performance counter unit (PCU) access"""
def __init__(self, dmgr, core_device="core"):
self.core = dmgr.get(core_device)
@kernel
def pc_start():
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):
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
"""