Skip to content

Commit

Permalink
Show rate as float
Browse files Browse the repository at this point in the history
  • Loading branch information
slacrherbst committed Sep 20, 2023
1 parent 6774789 commit 57eeb33
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/test_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#logger = logging.getLogger('pyrogue')
#logger.setLevel(logging.DEBUG)

MaxCycles = { 'remoteSetRate' : 42000,
'remoteSetNvRate' : 46000,
'remoteGetRate' : 54000,
'localSetRate' : 36000,
'localGetRate' : 55000,
'linkedSetRate' : 36000,
'linkedGetRate' : 45000 }
MaxCycles = { 'remoteSetRate' : 4.2e4,
'remoteSetNvRate' : 4.6e4,
'remoteGetRate' : 5.4e4,
'localSetRate' : 3.6e4,
'localGetRate' : 5.5e4,
'linkedSetRate' : 3.6e4,
'linkedGetRate' : 4.5e4 }

class TestDev(pr.Device):

Expand Down Expand Up @@ -115,62 +115,62 @@ def test_rate():
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemote.set(i)
resultCycles['remoteSetRate'] = hwcounter.count_end() - scount
resultCycles['remoteSetRate'] = float(hwcounter.count_end() - scount)
resultRate['remoteSetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemoteNoVerify.set(i)
resultCycles['remoteSetNvRate'] = hwcounter.count_end() - scount
resultCycles['remoteSetNvRate'] = float(hwcounter.count_end() - scount)
resultRate['remoteSetNvRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestRemote.get()
resultCycles['remoteGetRate'] = hwcounter.count_end() - scount
resultCycles['remoteGetRate'] = float(hwcounter.count_end() - scount)
resultRate['remoteGetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLocal.set(i)
resultCycles['localSetRate'] = hwcounter.count_end() - scount
resultCycles['localSetRate'] = float(hwcounter.count_end() - scount)
resultRate['localSetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLocal.get()
resultCycles['localGetRate'] = hwcounter.count_end() - scount
resultCycles['localGetRate'] = float(hwcounter.count_end() - scount)
resultRate['localGetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLink.set(i)
resultCycles['linkedSetRate'] = hwcounter.count_end() - scount
resultCycles['linkedSetRate'] = float(hwcounter.count_end() - scount)
resultRate['linkedSetRate'] = int(1/((time.time()-stime) / count))

stime = time.time()
scount = hwcounter.count()
with root.updateGroup():
for i in range(count):
root.TestDev.TestLink.get(i)
resultCycles['linkedGetRate'] = hwcounter.count_end() - scount
resultCycles['linkedGetRate'] = float(hwcounter.count_end() - scount)
resultRate['linkedGetRate'] = int(1/((time.time()-stime) / count))

passed = True

for k,v in MaxCycles.items():

print(f"{k} cyles {resultCycles[k]}, maximum {v}, rate {resultRate[k]}")
print(f"{k} cyles {resultCycles[k]:.2e}, maximum {v:.2e}, rate {resultRate[k]}")

if resultCycles[k] > v:
passed = False
Expand Down

0 comments on commit 57eeb33

Please sign in to comment.