From: Siraaj Khandkar Date: Fri, 29 Jun 2018 22:17:07 +0000 (-0400) Subject: Show current net io rates X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=f32c814ff7d5de33d091209e4ae40435c42b45bd;p=khatus.git Show current net io rates --- diff --git a/bin/khatus_show b/bin/khatus_show index ad5b060..ae9bf0f 100755 --- a/bin/khatus_show +++ b/bin/khatus_show @@ -59,6 +59,35 @@ disk=$( printf("%s%d%%", direction, curr); }') +io_net=$( + awk ' + BEGIN { + bytes_per_unit = 1024 + } + + NR > 2 { + device = $1; sub(":$", "", device); + curr_read = $2; + curr_write = $10; + + prev_file_prefix = "/home/siraaj/var/run/status/io_net_" device; + prev_read_file = prev_file_prefix "_read"; + prev_write_file = prev_file_prefix "_write"; + + getline prev_read < prev_read_file; + getline prev_write < prev_write_file; + + diff_read = (curr_read - prev_read ) / bytes_per_unit; + diff_write = (curr_write - prev_write) / bytes_per_unit; + + print curr_read > prev_read_file; + print curr_write > prev_write_file; + + printf("%s %0.0f▲ %0.0f▼\n", device, diff_write, diff_read); + } + ' /proc/net/dev +) + energy=$( upower -e \ | grep battery \ @@ -275,7 +304,7 @@ echo \ B:$bluetooth_power\ \ \ - W:$wifi\ + W:[$wifi $(echo "$io_net" | awk '/^wlp3s0/ {print $2, $3}')]\ \ \ $signal_last_msg_age\