When examining performance information it is nice to not
have to look at daemons who you are not interested in.

Signed-off-by: Donald Sharp <[email protected]>
Reviewed-by: Don Slice <[email protected]>
---
 vtysh/vtysh.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index b55c671..c578c3d 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -85,6 +85,19 @@ vclient_close (struct vtysh_client *vclient)
     }
 }
 
+/* Return true if str begins with prefix, else return false */
+static int
+begins_with(const char *str, const char *prefix)
+{
+  if (!str || !prefix)
+    return 0;
+  size_t lenstr = strlen(str);
+  size_t lenprefix = strlen(prefix);
+  if (lenprefix >  lenstr)
+    return 0;
+  return strncmp(str, prefix, lenprefix) == 0;
+}
+
 /* Following filled with debug code to trace a problematic condition
  * under load - it SHOULD handle it. */
 #define ERR_WHERE_STRING "vtysh(): vtysh_client_config(): "
@@ -1345,6 +1358,33 @@ DEFUN (vtysh_show_work_queues,
   return ret;
 }
 
+DEFUN (vtysh_show_work_queues_daemon,
+       vtysh_show_work_queues_daemon_cmd,
+       "show work-queues (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd)",
+       SHOW_STR
+       "Work Queue information\n"
+       "For the zebra daemon\n"
+       "For the rip daemon\n"
+       "For the ripng daemon\n"
+       "For the ospf daemon\n"
+       "For the ospfv6 daemon\n"
+       "For the bgp daemon\n"
+       "For the isis daemon\n")
+{
+  unsigned int i;
+  int ret = CMD_SUCCESS;
+
+  for (i = 0; i < array_size(vtysh_client); i++)
+    {
+      if (begins_with(vtysh_client[i].name, argv[0]))
+        break;
+    }
+
+  ret = vtysh_client_execute(&vtysh_client[i], "show work-queues\n", stdout);
+
+  return ret;
+}
+
 /* Memory */
 DEFUN (vtysh_show_memory,
        vtysh_show_memory_cmd,
@@ -2447,7 +2487,7 @@ vtysh_init_vty (void)
   /* "write terminal" command. */
   install_element (ENABLE_NODE, &vtysh_write_terminal_cmd);
   install_element (ENABLE_NODE, &vtysh_write_terminal_daemon_cmd);
- 
+
   install_element (CONFIG_NODE, &vtysh_integrated_config_cmd);
   install_element (CONFIG_NODE, &no_vtysh_integrated_config_cmd);
 
@@ -2492,6 +2532,8 @@ vtysh_init_vty (void)
 
   install_element (VIEW_NODE, &vtysh_show_work_queues_cmd);
   install_element (ENABLE_NODE, &vtysh_show_work_queues_cmd);
+  install_element (ENABLE_NODE, &vtysh_show_work_queues_daemon_cmd);
+  install_element (VIEW_NODE, &vtysh_show_work_queues_daemon_cmd);
 
   install_element (VIEW_NODE, &vtysh_show_thread_cmd);
   install_element (ENABLE_NODE, &vtysh_show_thread_cmd);
-- 
1.9.1


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to