summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-14 01:07:44 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-14 01:09:21 +0200
commitb4c2ce830188d0bd8bb84014a623ecb06c160ed9 (patch)
treec81c1e1a03b9b7c8f65d5fc44f1f7521709971e3 /kern
parent9f523da9e60aa8b8748dd320b04d8e42a5209668 (diff)
kern/syscnt: new syscnt_info shell command
Diffstat (limited to 'kern')
-rw-r--r--kern/kernel.c2
-rw-r--r--kern/syscnt.c27
-rw-r--r--kern/syscnt.h5
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