lantiq: add integer latency stat for lantiq-dsl
authorAndre Heider <a.heider@gmail.com>
Mon, 10 Dec 2018 09:06:50 +0000 (10:06 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 15 Dec 2018 23:57:19 +0000 (00:57 +0100)
The current stats always have a 'ms' suffix, and they're used by luci.
Introduce dsl.latency_[down|up] values, exported in ┬Ás without suffix.

Signed-off-by: Andre Heider <a.heider@gmail.com>
target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh

index a76fec9..8665240 100755 (executable)
@@ -64,6 +64,12 @@ scale_latency() {
        printf "%d.%d ms" ${a} ${b}
 }
 
+scale_latency_us() {
+       local val=$1
+
+       expr $val \* 10
+}
+
 #
 # convert vendorid into human readable form
 #
@@ -428,6 +434,8 @@ latency_delay() {
        sidd=$(scale_latency $idd)
 
        if [ "$action" = "lucistat" ]; then
+               echo "dsl.latency_down=\"$(scale_latency_us $idd)\""
+               echo "dsl.latency_up=\"$(scale_latency_us $idu)\""
                echo "dsl.latency_num_down=\"$sidd\""
                echo "dsl.latency_num_up=\"$sidu\""
                echo "dsl.latency_s_down=\"$idd_s\""