How to do speedtest with available package?

sorry @Grommish, i dont get ur script. so its like the script will auto kill after x second?

finally i succeed build auto SQM with minimalist package and still in trial testing. put it on cron every 4 hours

but i still have 2 problem

  1. still cant measure upload speed. lack of curl & with SCP it has delay for auth so it will make it bit not accurate
  2. my wget method sometimes cant make the internet speed to the max, i test with my other router with max down speed till 70mbps, only can reach 10mbps :frowning:

this is my github repo, maybe u can give some advice :slight_smile:

hi @Grommish,
how to get the Kbps with accurate value?
i convert mbps to kbps by multiple it by 1000, but the result is not meet my expectation

Because 1000 isn't the right scale.

Here is a final version of the script you can use. This is going to be about as best you can get unless you've got Python on your device.

#!/bin/sh
# 
# usage: ./localspeed <# of rounds>
#
# Defaults to 5 rounds
a=1
if [ -z $1 ]
then
   b=5
else
   b=$1
fi

while [ $a -le $b ]; do
   RX_1=`ifconfig eth0 | grep "RX bytes" | cut -f 2 -d : | cut -f 1 -d "("`
   TX_1=`ifconfig eth0 | grep "TX bytes" | cut -f 3 -d : | cut -f 1 -d "("`
   sleep 6
   RX_2=`ifconfig eth0 | grep "RX bytes" | cut -f 2 -d : | cut -f 1 -d "("`
   TX_2=`ifconfig eth0 | grep "TX bytes" | cut -f 3 -d : | cut -f 1 -d "("`

   RX_3=$(($RX_2 - $RX_1))
   RX_BYTES=$(($RX_3 * 10 / 60))
   RX_MBITS=$(($RX_BYTES / 125000))
   RX_KBITS=$(($RX_BYTES / 125))

   TX_3=$(($TX_2 - $TX_1))
   TX_BYTES=$(($TX_3 * 10 / 60))
   TX_MBITS=$(($TX_BYTES / 125000))
   TX_KBITS=$(($TX_BYTES / 125))

   echo "Average bytes difference ($a): download - $RX_BYTES bytes, upload - $TX_BYTES bytes"
   echo "Average download - $RX_MBITS Mbits/s ($RX_KBITS Kbits/s), upload - $TX_MBITS Mbits/s ($TX_K"
   a=$((a + 1))
done

1 Like

thanks
it's working

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.