diff --git a/applications/arts/designs/arts_unb1_sc1_bf_offload/tb/sh/em2_packet_rate.py b/applications/arts/designs/arts_unb1_sc1_bf_offload/tb/sh/em2_packet_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..ea146890f0599da2a00ca846f4e01e234d055706 --- /dev/null +++ b/applications/arts/designs/arts_unb1_sc1_bf_offload/tb/sh/em2_packet_rate.py @@ -0,0 +1,35 @@ +import subprocess +import time + +######################################################################## +# Execute ifconfig twice with a one second interval to find the number +# of packets received per second. +######################################################################## + +cmd = 'ifconfig' +args = 'em2' + +cmd_output = [] +rx_packets_str = [] +rx_packets = [] +rx_bytes_str = [] +rx_bytes = [] + +for i in range(2): + p = subprocess.Popen([cmd, args], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + cmd_output.append(out) + time.sleep(1) + +for i in range(2): + string_list = cmd_output[i].split() + rx_packets_str.append(string_list[17]) + rx_bytes_str.append(string_list[19]) + rx_packets.append(int(rx_packets_str[i])) #.split(':')[1])) + rx_bytes.append(int(rx_bytes_str[i])) #.split(':')[1])) + +packets_per_second = rx_packets[1]-rx_packets[0] +gigabits_per_second = (float(rx_bytes[1]-rx_bytes[0])*8)/1000000000 +print '\n', packets_per_second, 'packets per second' +print gigabits_per_second, 'Gbps\n' + diff --git a/applications/arts/designs/arts_unb1_sc1_bf_offload/tb/sh/p4p1_packet_rate.py b/applications/arts/designs/arts_unb1_sc1_bf_offload/tb/sh/p4p1_packet_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..22644ee5a7b06911c6b6cad6e6015dabd7f12bdc --- /dev/null +++ b/applications/arts/designs/arts_unb1_sc1_bf_offload/tb/sh/p4p1_packet_rate.py @@ -0,0 +1,35 @@ +import subprocess +import time + +######################################################################## +# Execute ifconfig twice with a one second interval to find the number +# of packets received per second. +######################################################################## + +cmd = 'ifconfig' +args = 'p4p1' + +cmd_output = [] +rx_packets_str = [] +rx_packets = [] +rx_bytes_str = [] +rx_bytes = [] + +for i in range(2): + p = subprocess.Popen([cmd, args], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + cmd_output.append(out) + time.sleep(1) + +for i in range(2): + string_list = cmd_output[i].split() + rx_packets_str.append(string_list[17]) + rx_bytes_str.append(string_list[19]) + rx_packets.append(int(rx_packets_str[i])) #.split(':')[1])) + rx_bytes.append(int(rx_bytes_str[i])) #.split(':')[1])) + +packets_per_second = rx_packets[1]-rx_packets[0] +gigabits_per_second = (float(rx_bytes[1]-rx_bytes[0])*8)/1000000000 +print '\n', packets_per_second, 'packets per second' +print gigabits_per_second, 'Gbps\n' +