-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4228e50
commit defecde
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /usr/bin/python | ||
|
||
import sys, os | ||
import time | ||
import random | ||
|
||
from pylibftdi import Driver, Device | ||
|
||
dev_list = Driver().list_devices() | ||
if len(dev_list) != 0: | ||
print "Following devices found:" | ||
for device_ in dev_list: | ||
print device_ | ||
|
||
dev = Device(device_id="FTZ17IRO", mode='b', interface_select=2) | ||
dev.open() | ||
|
||
|
||
epochs = 1024*10 | ||
BLOCK_LEN = 2048 | ||
tx_data = bytearray([ random.randrange(0, 256) for i in range(BLOCK_LEN)]) | ||
ts = time.time() | ||
while epochs: | ||
|
||
dev.write(tx_data) | ||
rx_data = bytearray(dev.read(BLOCK_LEN)) | ||
|
||
#print "Epoch: {}".format(epochs) | ||
failed = False | ||
for i in range(BLOCK_LEN): | ||
if ((tx_data[i]+1)%256) != rx_data[i]: | ||
print "Epoch: {}".format(epochs) | ||
print "[Test] Test 2: Data verification failed! , tx_data : ", tx_data[i], " =/= rx_data : ", rx_data[i] | ||
failed = True | ||
print "Breaking..." | ||
break | ||
if failed: | ||
break | ||
|
||
epochs -= 1 | ||
|
||
dev.close() | ||
te = time.time() | ||
print "Time {}".format(str(te-ts)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
import sys | ||
import subprocess | ||
|
||
times = [] | ||
epochs = 10 | ||
|
||
while epochs: | ||
run = subprocess.Popen(["python", "benchmark.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
for line in run.stdout: | ||
if "Time" in line: | ||
times.append(float(line.split()[1])) | ||
|
||
print times | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters