From: Keir Fraser Date: Wed, 12 May 2010 07:52:30 +0000 (+0100) Subject: xl: Add "xl top" command, a clone of "xm top". X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12185 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=59e0af401add55caa6351f21cc0637422556a02f;p=xen.git xl: Add "xl top" command, a clone of "xm top". Signed-off-by: Yang Hongyang --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 1e2304756e..ddb0bfd132 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3098,3 +3098,23 @@ int main_sysrq(int argc, char **argv) exit(0); } + +int main_top(int argc, char **argv) +{ + int opt; + + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case 'h': + help("top"); + exit(0); + default: + fprintf(stderr, "option `%c' not supported.\n", opt); + break; + } + } + + system("xentop"); + + exit(0); +} diff --git a/tools/libxl/xl_cmdimpl.h b/tools/libxl/xl_cmdimpl.h index c08c5d1593..3c7b9fd1f6 100644 --- a/tools/libxl/xl_cmdimpl.h +++ b/tools/libxl/xl_cmdimpl.h @@ -40,5 +40,6 @@ int main_domname(int argc, char **argv); int main_rename(int argc, char **argv); int main_trigger(int argc, char **argv); int main_sysrq(int argc, char **argv); +int main_top(int argc, char **argv); void help(char *command); diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index 33582a79d9..3609e1b93f 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -177,6 +177,11 @@ struct cmd_spec cmd_table[] = { "Send a sysrq to a domain", " ", }, + { "top", + &main_top, + "Monitor a host and the domains in real time", + "", + }, }; int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);