Skip to content

Commit

Permalink
Add rate test
Browse files Browse the repository at this point in the history
  • Loading branch information
slacrherbst committed Sep 20, 2023
1 parent d474399 commit 655649a
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions tests/test_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
#logger = logging.getLogger('pyrogue')
#logger.setLevel(logging.DEBUG)

MinRate = { 'remoteSetRate' : 100000,
'remoteSetNvRate' : 100000,
'remoteGetRate' : 100000,
'localSetRate' : 100000,
'localGetRate' : 100000,
'linkedSetRate' : 100000,
'linkedGetRate' : 100000 }

class TestDev(pr.Device):

def __init__(self,**kwargs):
Expand Down Expand Up @@ -103,52 +111,55 @@ def test_rate():
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemote.set(i)
remoteSetRate = 1/((time.time()-stime) / count)
result['remoteSetRate'] = 1/((time.time()-stime) / count)

stime = time.time()
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemoteNoVerify.set(i)
remoteSetNvRate = 1/((time.time()-stime) / count)
result['remoteSetNvRate'] = 1/((time.time()-stime) / count)

stime = time.time()
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemote.get()
remoteGetRate = 1/((time.time()-stime) / count)
result['remoteGetRate'] = 1/((time.time()-stime) / count)

stime = time.time()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLocal.set(i)
localSetRate = 1/((time.time()-stime) / count)
result['localSetRate'] = 1/((time.time()-stime) / count)

stime = time.time()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLocal.get()
localGetRate = 1/((time.time()-stime) / count)
result['localGetRate'] = 1/((time.time()-stime) / count)

stime = time.time()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLink.set(i)
linkedSetRate = 1/((time.time()-stime) / count)
result['linkedSetRate'] = 1/((time.time()-stime) / count)

stime = time.time()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLink.get(i)
linkedGetRate = 1/((time.time()-stime) / count)
result['linkedGetRate'] = 1/((time.time()-stime) / count)

passed = True

for k,v in MinRate.items():

print(f"{k} target {v} result {result[k]}")

print(f"Remote Set Rate = {remoteSetRate:.0f}")
print(f"Remote Set Nv Rate = {remoteSetNvRate:.0f}")
print(f"Remote Get Rate = {remoteGetRate:.0f}")
print(f"Local Set Rate = {localSetRate:.0f}")
print(f"Local Get Rate = {localGetRate:.0f}")
print(f"Linked Set Rate = {linkedSetRate:.0f}")
print(f"Linked Get Rate = {linkedGetRate:.0f}")
if result[k] < v:
passed = False

if passed is False:
raise AssertionError('Rate check failed')

if __name__ == "__main__":
test_rate()

0 comments on commit 655649a

Please sign in to comment.