diff options
-rw-r--r-- | kern/kernel.c | 2 | ||||
-rw-r--r-- | kern/syscnt.c | 27 | ||||
-rw-r--r-- | kern/syscnt.h | 5 |
3 files changed, 34 insertions, 0 deletions
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 <kern/shell.h> #include <kern/sleepq.h> #include <kern/sref.h> +#include <kern/syscnt.h> #include <kern/task.h> #include <kern/thread.h> #include <kern/turnstile.h> @@ -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 <kern/init.h> #include <kern/list.h> #include <kern/mutex.h> +#include <kern/shell.h> #include <kern/spinlock.h> #include <kern/syscnt.h> @@ -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 [<prefix>]", + "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 |