From 51b9e7a396be16a8fda47d2fd891c72db7f4f4d0 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 22 Jan 2011 16:02:13 +0100 Subject: [PATCH] stats: Implement VTY command to dump the linksets --- src/vty_interface.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/vty_interface.c b/src/vty_interface.c index 0cf5929..83d33c8 100644 --- a/src/vty_interface.c +++ b/src/vty_interface.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -275,6 +276,30 @@ DEFUN(cfg_lac, cfg_lac_cmd, return CMD_SUCCESS; } +static void dump_stats(struct vty *vty, struct mtp_link_set *set) +{ + struct mtp_link *link; + + vty_out(vty, "Linkset opc: %d%s", set->opc, VTY_NEWLINE); + vty_out_rate_ctr_group(vty, " ", set->ctrg); + + llist_for_each_entry(link, &set->links, entry) { + vty_out(vty, " Link %d%s", link->link_no, VTY_NEWLINE); + vty_out_rate_ctr_group(vty, " ", link->ctrg); + } +} + +DEFUN(show_stats, show_stats_cmd, + "show statistics", + SHOW_STR "Display Linkset statistics\n") +{ + if (bsc.link_set) + dump_stats(vty, bsc.link_set); + if (bsc.m2ua_set) + dump_stats(vty, bsc.m2ua_set); + return CMD_SUCCESS; +} + void cell_vty_init(void) { cmd_init(1); @@ -303,6 +328,10 @@ void cell_vty_init(void) install_element(CELLMGR_NODE, &cfg_mcc_cmd); install_element(CELLMGR_NODE, &cfg_mnc_cmd); install_element(CELLMGR_NODE, &cfg_lac_cmd); + + + /* show commands */ + install_element_ve(&show_stats_cmd); } const char *openbsc_copyright = "";