From b4c2ce830188d0bd8bb84014a623ecb06c160ed9 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Wed, 14 Jun 2017 01:07:44 +0200 Subject: kern/syscnt: new syscnt_info shell command --- kern/kernel.c | 2 ++ kern/syscnt.c | 27 +++++++++++++++++++++++++++ kern/syscnt.h | 5 +++++ 3 files changed, 34 insertions(+) (limited to 'kern') diff --git a/kern/kernel.c b/kern/kernel.c index f079f9a2..326c70a1 100644 --- a/kern/kernel.c +++ b/kern/kernel.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,7 @@ kernel_main(void) percpu_cleanup(); shell_setup(); + syscnt_register_shell_cmds(); cpumap_setup(); xcall_setup(); task_setup(); diff --git a/kern/syscnt.c b/kern/syscnt.c index 5b479f36..2e042bc6 100644 --- a/kern/syscnt.c +++ b/kern/syscnt.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,32 @@ syscnt_setup(void) mutex_init(&syscnt_lock); } +#ifdef X15_SHELL + +static void +syscnt_shell_info(int argc, char **argv) +{ + char *prefix; + + prefix = (argc >= 2) ? argv[1] : NULL; + syscnt_info(prefix); +} + + +static struct shell_cmd syscnt_shell_cmds[] = { + SHELL_CMD_INITIALIZER("syscnt_info", syscnt_shell_info, + "syscnt_info []", + "Show information about system counters"), +}; + +#endif /* X15_SHELL */ + +void __init +syscnt_register_shell_cmds(void) +{ + SHELL_REGISTER_CMDS(syscnt_shell_cmds); +} + void __init syscnt_register(struct syscnt *syscnt, const char *name) { diff --git a/kern/syscnt.h b/kern/syscnt.h index a4bae3d7..35a291d9 100644 --- a/kern/syscnt.h +++ b/kern/syscnt.h @@ -57,6 +57,11 @@ void syscnt_setup(void); */ void syscnt_register(struct syscnt *syscnt, const char *name); +/* + * Register shell commands. + */ +void syscnt_register_shell_cmds(void); + #ifdef ATOMIC_HAVE_64B_OPS static inline void -- cgit v1.2.3