[OpenWrt-Devel] [PATCH] lantiq: add integer latency stat for lantiq-dsl

Andre Heider a.heider at gmail.com
Mon Dec 10 04:06:50 EST 2018


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 at gmail.com>
---
The idea is to use sane values for metrics, see
https://github.com/openwrt/packages/pull/7594

 .../linux/lantiq/base-files/lib/functions/lantiq_dsl.sh   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
index a76fec94ed..8665240da4 100755
--- a/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
+++ b/target/linux/lantiq/base-files/lib/functions/lantiq_dsl.sh
@@ -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\""
-- 
2.20.0.rc2


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list