test/throughput
The test/throughput application allows testing of throughput for a variety of configurations:
-
Interfaces
- WLAN
- SoftAP
- Ethernet
-
Protocol
- UDP
- TCP
-
Directions
- Transmit (Client)
- Receive (Server)
A device can be configured as a client or a server. For bi-directional tests, a device can be set up as both a server and client.
App Commands
The app creates two new commands:
throughput_start
Abbreviation
tstart
Description
Start a client or server for throughput testing.
Syntax
throughput_start <type> -p <port> -i <interval> [-ip <ip_address>] -t <duration> [<protocol>]
where:
-
<type>
- options:-
-s
- server -
-c
- client
-
-
-t <test_duration>
- duration of test. Unit: seconds. -
-i <interval>
- interval to post result of throughput test. Type: float Unit: seconds. If the interval is set to0
, the user polls results using the throughput_result command. -
-p <port>
- port to connect to (client) or listen on (server). Type: integer. -
-ip <ip_address>
- IP address, required for clients. -
<protocol>
- options:-
default if not supplied:
TCP
. -
-u
-UDP
.
-
default if not supplied:
Examples
Start a UDP server listening on port
8000
, posting results every second, running for
30
seconds:
throughput_start -s -p 8000 -i 1 -t 30
Start a client TCP connection to IP address
192.168.0.1
, port
50000
, posting results every
500
ms, and running for
60
seconds:
throughput_start -c -ip 192.168.0.1 -p 50000 -t 60 -i 0.5
throughput_result
Abbreviation
tresult
Description
Poll the results of a throughput test of client or server type.
Returns a string of the form:
[<type>][<interval_time>] sent/received: <kb> Kbytes, Bandwidth: <bits/second>
e.g.
[c][0.97] sent: 17 Kbytes, Bandwidth: 148291.87
Syntax
throughput_result <type>
where:
-
<type>
- options:-
-s
- server -
-c
- client
-
Examples
Poll the data for a server throughput test:
throughput_result -s
Device Configuration
To set the interface, use the network.default_interface variable, e.g.
set network.default_interface wlan
The protocol and client or server type are set with the app
throughput_start
command.
Testing Script
The script
throughput.py
is provided for either manual or automated testing of the
throughput
app.
Run the
throughput.py
on a computer connected to the same network as the Gecko OS test device. When the test device runs as a
server
type, the test computer polls as a
client
type.
Command Line
On the command line, run
throughput.py
with the same arguments documented above for the
throughput_start
command, e.g.
server:
python throughput.py -s -p 8000 -i 1 -t 30
client:
python throughput.py -c -ip 192.168.0.1 -p 8000 -t 30 -i 1
Python Script
You can import from the throughput module to automate testing:
server:
from throughput import throughput_start
...
server = throughput_start("-s", test_machine_ip, test_port, interval, duration, proto)
...
client:
from throughput import throughput_start
...
client = throughput_start("-c", dut_ip, test_port, interval, duration, proto)
...
Example Operation
WLAN - Gecko OS Device Server
On Gecko OS Terminal:
<ssid>
: the SSID of the network to which the Gecko OS Device and the test computer are connected.
<passkey>
: the passkey of the network
set wlan.ssid <ssid>
set wlan.passkey <passkey>
set network.default_interface wlan
save
throughput_start -s -p 8000 -i 1 -t 4
At test computer command prompt:
<DUT_IP>
- the IP address of the Gecko OS Device.
python throughput.py -c -ip <DUT_IP> -p 8000 -t 4 -i 1
The Gecko OS terminal output is similar to the following:
TCP client connected
Server thread started.
[s][0.00 - 1.00] total_received: 98 KBytes, Bandwidth: 810624.00
[s][1.00 - 2.00] total_received: 122 KBytes, Bandwidth: 1001688.00
[s][2.00 - 3.00] total_received: 113 KBytes, Bandwidth: 929776.00
[s][3.00 - 4.00] total_received: 212 KBytes, Bandwidth: 1742496.00
TCP client disconnected
[2019-11-20 | 00:42:20: Closed: 1]
TCP server stopped
The test computer python script output is similar to the following:
Throughput is connecting ('DUT_IP', 8000)
[c][0.0 - 1.0] total: 157 KBytes, bandwidth: 1.2 Mbits/sec
[c][1.0 - 2.0] total: 122 KBytes, bandwidth: 978.5 kbits/sec
[c][2.0 - 3.0] total: 113 KBytes, bandwidth: 908.1 kbits/sec
[c][3.0 - 4.0] total: 213 KBytes, bandwidth: 1.7 Mbits/sec
WLAN - Gecko OS Device Client
On Gecko OS Terminal:
throughput_start -c -ip TEST_MACHINE_IP -p 8000 -t 3 -i 1
interval = 1000
In progress
Resolving host: TEST_MACHINE_IP
LOCAL> Connecting (TCP): TEST_MACHINE_IP:8000
Meter TCP client is connected to a receiver. Start sending data
[c][0.00 - 1.00] total_sent: 19 Kbytes, Bandwidth: 160320.00
[c][1.00 - 2.00] total_sent: 19 Kbytes, Bandwidth: 160320.00
[c][2.00 - 3.00] total_sent: 21 Kbytes, Bandwidth: 176352.00
timer event
Client transfer is completed.
At test computer command prompt:
python throughput.py -s -p 8000 -i 1 -t 3
Throughput is connecting ('', 8000)
TCP server is listening on ('', 8000)
[s][0.0 - 1.0] total: 18 KBytes, bandwidth: 148.7 kbits/sec
[s][1.0 - 2.0] total: 19 KBytes, bandwidth: 156.6 kbits/sec
[s][2.0 - 3.0] total: 21 KBytes, bandwidth: 172.2 kbits/sec