tc: Show classes in tree view
Subsystems (2)
PATCH v3 1/1 tc: Show classes in tree view
From: Vadim Kochan <[email protected]>
Added new '-t[ree]' which shows classes dependency in the tree view. Meanwhile only generic stats info is supported.
e.g.:
$ tc/tc -t class show dev tap0
+---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
| +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
| +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
| | +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
| |
| +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
|
+---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
+---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
+---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
+---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b$ tc/tc -t -s class show dev tap0
+---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
| | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| | rate 0bit 0pps backlog 0b 0p requeues 0
| |
| +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
| | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| | rate 0bit 0pps backlog 0b 0p requeues 0
| |
| +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
| | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| | | rate 0bit 0pps backlog 0b 0p requeues 0
| | |
| | +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
| | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| | rate 0bit 0pps backlog 0b 0p requeues 0
| |
| +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
| Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| rate 0bit 0pps backlog 0b 0p requeues 0
|
+---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b
| Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| rate 0bit 0pps backlog 0b 0p requeues 0
|
+---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b
| Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| rate 0bit 0pps backlog 0b 0p requeues 0
|
+---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b
| Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| rate 0bit 0pps backlog 0b 0p requeues 0
|
+---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0---
Changes v3:
Fixed wrong brackets style
Changes v2:
Removed "Date:" from commit message which was added by mistake.
Changes RFC -> PATCH:
#1 get rid of INIT_HLIST_NODE
#2 added sample output to commit message
#3 use "show_tree=1" instead of "show_tree++"
#4 no need update include/hlist.h (because of #1)
#5 changed a little tree output: parentheses around class id instead of qdisc name
tc/tc.c | 5 +- tc/tc_class.c | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- tc/tc_common.h | 2 + 3 files changed, 165 insertions(+), 3 deletions(-)
tc/tc.c +4 -1
@@ -34,8 +34,9 @@ int show_stats = 0;int show_details =0 ;int show_raw =0 ;int show_pretty =0 ; -int batch_mode =0 ; +int show_tree =0 ; +int batch_mode =0 ;int resolve_hosts =0 ;int use_iec =0 ;int force =0 ;
@@ -278,6 +279,8 @@ int main(int argc, char **argv) ++show_raw; }else if (matches (argv[1 ],"-pretty" ) ==0 ) { ++show_pretty; + }else if (matches (argv[1 ],"-tree" ) ==0 ) { + show_tree =1 ; }else if (matches (argv[1 ],"-Version" ) ==0 ) {printf ("tc utility, iproute2-ss%s\n" ,SNAPSHOT );return 0 ;
tc/tc_class.c +159 -2
203 lines not on this page · raw message
tc/tc_common.h +2 -0
@@ -19,3 +19,5 @@ extern int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *eststruct tc_sizespec ;extern int parse_size_table (int *p_argc,char ***p_argv,struct tc_sizespec *s);extern int check_size_table_opts (struct tc_sizespec *s); + +extern int show_tree;
Signature · 1 line
2.1.3
Quoted 73 lines · On Wed, 24 Dec 2014 02:46:16 +0200 Vadim Kochan <[email protected]> wrote:
From: Vadim Kochan <[email protected]>
Added new '-t[ree]' which shows classes dependency in the tree view. Meanwhile only generic stats info is supported.
e.g.:
$ tc/tc -t class show dev tap0 +---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b | +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b | +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b | | +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | | | +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | +---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b +---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b +---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b +---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b$ tc/tc -t -s class show dev tap0 +---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b | | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | | | +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0Signed-off-by Vadim Kochan <[email protected]>---
Changes v3:
Fixed wrong brackets styleChanges v2:
Removed "Date:" from commit message which was added by mistake.Changes RFC -> PATCH:
#1 get rid ofINIT_HLIST_NODE
#2 added sample output to commit message
#3 use "show_tree=1" instead of "show_tree++"
#4 no need updateinclude/hlist.h(because of #1)
#5 changed a little tree output: parentheses around class id instead of qdisc name
Quoted 4 lines
tc/tc.c | 5 +- tc/tc_class.c | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- tc/tc_common.h | 2 + 3 files changed, 165 insertions(+), 3 deletions(-)
I don't get strict about checkpatch. But ran this patch through and there are some minor things that would be good to fix.
1. Split long lines like:
WARNING: line over 80 characters
#198: FILE: tc/tc_class.c:219:
+static void tree_cls_show(FILE *fp, char *buf, struct hlist_head *root_list, int level)
2. Don't use variable name 'childs', makes sense to call it children instead??
3. Don't use space before * as in:
ERROR: "foo * bar" should be "foo *bar"
#285: FILE: tc/tc_class.c:305:
+ struct rtattr * tb[TCA_MAX+1] = {};
Quoted 97 lines · Stephen Hemminger
Quoted 73 lines · On Wed, 24 Dec 2014 02:46:16 +0200 Vadim Kochan <[email protected]> wrote:
From: Vadim Kochan <[email protected]>
Added new '-t[ree]' which shows classes dependency in the tree view. Meanwhile only generic stats info is supported.
e.g.:
$ tc/tc -t class show dev tap0 +---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b | +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b | +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b | | +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | | | +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | +---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b +---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b +---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b +---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b$ tc/tc -t -s class show dev tap0 +---(1:2) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | +---(1:40) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | +---(1:50) htb rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b | | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | | | +---(1:51) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | | rate 0bit 0pps backlog 0b 0p requeues 0 | | | +---(1:60) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:1) htb rate 6Mbit ceil 6Mbit burst 15Kb cburst 1599b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:10) htb prio 0 rate 5Mbit ceil 5Mbit burst 15Kb cburst 1600b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:20) htb prio 0 rate 3Mbit ceil 6Mbit burst 15Kb cburst 1599b | Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) | rate 0bit 0pps backlog 0b 0p requeues 0 | +---(1:30) htb prio 0 rate 1Kbit ceil 6Mbit burst 15Kb cburst 1599b Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0Signed-off-by Vadim Kochan <[email protected]>---
Changes v3:
Fixed wrong brackets styleChanges v2:
Removed "Date:" from commit message which was added by mistake.Changes RFC -> PATCH:
#1 get rid ofINIT_HLIST_NODE
#2 added sample output to commit message
#3 use "show_tree=1" instead of "show_tree++"
#4 no need updateinclude/hlist.h(because of #1)
#5 changed a little tree output: parentheses around class id instead of qdisc nameQuoted 4 lines
tc/tc.c | 5 +- tc/tc_class.c | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- tc/tc_common.h | 2 + 3 files changed, 165 insertions(+), 3 deletions(-)I don't get strict about checkpatch. But ran this patch through and there are some minor things that would be good to fix.
1. Split long lines like:
WARNING: line over 80 characters
#198: FILE:tc/tc_class.c:219:
+static voidtree_cls_show(FILE *fp, char *buf, struct hlist_head *root_list, int level)2. Don't use variable name 'childs', makes sense to call it children instead??
3. Don't use space before * as in:
ERROR: "foo * bar" should be "foo *bar"
#285: FILE:tc/tc_class.c:305:
Review
Quoted 1 line
(quoted diff) +1
-0+ struct rtattr * tb[TCA_MAX+1] = {};
I will fix them.
Quoted 6 lines · On Wed, 24 Dec 2014 02:46:16 +0200 Vadim Kochan <[email protected]> wrote:
From: Vadim Kochan <[email protected]>
Added new '-t[ree]' which shows classes dependency in the tree view. Meanwhile only generic stats info is supported.
I don't get strict about checkpatch. But ran this patch through and there are some minor things that would be good to fix.
1. Split long lines like:
WARNING: line over 80 characters
#198: FILE: tc/tc_class.c:219:
+static void tree_cls_show(FILE *fp, char *buf, struct hlist_head *root_list, int level)
2. Don't use variable name 'childs', makes sense to call it children instead??
3. Don't use space before * as in:
ERROR: "foo * bar" should be "foo *bar"
#285: FILE: tc/tc_class.c:305:
+ struct rtattr * tb[TCA_MAX+1] = {};