summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-02-02 18:38:00 -0600
committerLouis Burda <quent.burda@gmail.com>2023-02-02 18:39:13 -0600
commit0c825583fc20f1b91c56e1aaf450d6a753d24658 (patch)
treed62bb1dd3060c9987c67dc6bfe906f767f1c1d12 /util
parentca3b348013267bf727ba52bb6fc97a7ab7d367dc (diff)
downloadcachepc-0c825583fc20f1b91c56e1aaf450d6a753d24658.tar.gz
cachepc-0c825583fc20f1b91c56e1aaf450d6a753d24658.zip
qemu-pagestep is quasi-realtime when suppresing slow kernel logging
Diffstat (limited to 'util')
-rw-r--r--util/.gitignore2
-rw-r--r--util/debug.c25
-rw-r--r--util/loglevel.c34
3 files changed, 35 insertions, 26 deletions
diff --git a/util/.gitignore b/util/.gitignore
index dba752f..b17b1b3 100644
--- a/util/.gitignore
+++ b/util/.gitignore
@@ -1,3 +1,3 @@
-debug
+loglevel
reset
mainpfn
diff --git a/util/debug.c b/util/debug.c
deleted file mode 100644
index bfc8129..0000000
--- a/util/debug.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "cachepc/uapi.h"
-
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <err.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-int
-main(int argc, const char **argv)
-{
- uint32_t arg;
- int fd, ret;
-
- fd = open("/dev/kvm", O_RDONLY);
- if (fd < 0) err(1, "open");
-
- arg = argc > 1 ? atoi(argv[1]) : 1;
- ret = ioctl(fd, KVM_CPC_DEBUG, &arg);
- if (ret == -1) err(1, "ioctl KVM_CPC_DEBUG");
-
- close(fd);
-}
diff --git a/util/loglevel.c b/util/loglevel.c
new file mode 100644
index 0000000..e24923e
--- /dev/null
+++ b/util/loglevel.c
@@ -0,0 +1,34 @@
+#include "cachepc/uapi.h"
+
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <err.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+int
+main(int argc, const char **argv)
+{
+ uint32_t arg;
+ int fd, ret;
+
+ fd = open("/dev/kvm", O_RDONLY);
+ if (fd < 0) err(1, "open");
+
+ if (argc > 1 && !strcmp(argv[1], "debug"))
+ arg = CPC_LOGLVL_DBG;
+ else if (argc > 1 && !strcmp(argv[1], "info"))
+ arg = CPC_LOGLVL_INFO;
+ else
+ arg = 0;
+
+ printf("loglevel: %i\n", arg);
+ ret = ioctl(fd, KVM_CPC_LOGLEVEL, &arg);
+ if (ret == -1) err(1, "ioctl KVM_CPC_LOGLEVEL");
+
+ close(fd);
+}