diff options
author | Paul Jakma <paul.jakma@sun.com> | 2006-05-28 07:54:45 +0000 |
---|---|---|
committer | Paul Jakma <paul.jakma@sun.com> | 2006-05-28 07:54:45 +0000 |
commit | 362b4031faf591afb06b3859952ac5b83723a986 (patch) | |
tree | 92a3002497bddd419333a8a21477140e7840a25d /vtysh | |
parent | 369688c0c7a325e889e841afc2d59430baf079a2 (diff) |
[vtysh] Add "show memory" to vtysh
2006-05-24 Paul Jakma <paul.jakma@sun.com>
* vtysh.c: (general) Add 'show memory' command.
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/ChangeLog | 4 | ||||
-rw-r--r-- | vtysh/vtysh.c | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/vtysh/ChangeLog b/vtysh/ChangeLog index 3ad1c252..ac038e1c 100644 --- a/vtysh/ChangeLog +++ b/vtysh/ChangeLog @@ -1,3 +1,7 @@ +2006-05-24 Paul Jakma <paul.jakma@sun.com> + + * vtysh.c: (general) Add 'show memory' command. + 2006-05-21 Paul Jakma <paul.jakma@sun.com> * vtysh.c: (vtysh_show_logging_cmd) Suppress output for daemons diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 2dbb5337..110c361a 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1311,6 +1311,29 @@ ALIAS (vtysh_exit_interface, "quit", "Exit current mode and down to previous mode\n") +/* Memory */ +DEFUN (vtysh_show_memory, + vtysh_show_memory_cmd, + "show memory", + SHOW_STR + "Memory statistics\n") +{ + unsigned int i; + int ret = CMD_SUCCESS; + char line[] = "show memory\n"; + + for (i = 0; i < VTYSH_INDEX_MAX; i++) + if ( vtysh_client[i].fd >= 0 ) + { + fprintf (stdout, "Memory statistics for %s:\n", + vtysh_client[i].name); + ret = vtysh_client_execute (&vtysh_client[i], line, stdout); + fprintf (stdout,"\n"); + } + + return ret; +} + /* Logging commands. */ DEFUN (vtysh_show_logging, vtysh_show_logging_cmd, @@ -2349,6 +2372,9 @@ vtysh_init_vty (void) install_element (ENABLE_NODE, &vtysh_start_bash_cmd); install_element (ENABLE_NODE, &vtysh_start_zsh_cmd); + install_element (VIEW_NODE, &vtysh_show_memory_cmd); + install_element (ENABLE_NODE, &vtysh_show_memory_cmd); + /* Logging */ install_element (ENABLE_NODE, &vtysh_show_logging_cmd); install_element (VIEW_NODE, &vtysh_show_logging_cmd); |