Created
February 1, 2017 07:04
-
-
Save dmpatel151282/351c828f2eba0c39be9ccb4ef34501f0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Ethernet:- | |
- Make ethernet_bw.sh file. | |
- Copy below code snippet in file. | |
#!/bin/sh | |
INTERVAL="1" # update interval in seconds | |
while true | |
do | |
R1=`cat /sys/class/net/eth0/statistics/rx_bytes` | |
T1=`cat /sys/class/net/eth0/statistics/tx_bytes` | |
sleep $INTERVAL | |
R2=`cat /sys/class/net/eth0/statistics/rx_bytes` | |
T2=`cat /sys/class/net/eth0/statistics/tx_bytes` | |
TBPS=`expr $T2 - $T1` | |
RBPS=`expr $R2 - $R1` | |
TKBPS=`expr $TBPS / 1024` | |
RKBPS=`expr $RBPS / 1024` | |
echo "TX eth0: $TKBPS kB/s RX eth0: $RKBPS kB/s" | |
done | |
- Push ethernet_bw.sh file to Android device through ADB and start script. | |
WiFi :- | |
- Make wifi_bw.sh file. | |
- Copy below code snippet in file. | |
#!/bin/sh | |
INTERVAL="1" # update interval in seconds | |
while true | |
do | |
R1=`cat /sys/class/net/wlan0/statistics/rx_bytes` | |
T1=`cat /sys/class/net/wlan0/statistics/tx_bytes` | |
sleep $INTERVAL | |
R2=`cat /sys/class/net/wlan0/statistics/rx_bytes` | |
T2=`cat /sys/class/net/wlan0/statistics/tx_bytes` | |
TBPS=`expr $T2 - $T1` | |
RBPS=`expr $R2 - $R1` | |
TKBPS=`expr $TBPS / 1024` | |
RKBPS=`expr $RBPS / 1024` | |
echo "TX eth0: $TKBPS kB/s RX eth0: $RKBPS kB/s" | |
done | |
- Push wifi_bw.sh file to Android device through ADB and start script. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment