summaryrefslogtreecommitdiffstats
path: root/util/reset.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/reset.c')
-rw-r--r--util/reset.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/util/reset.c b/util/reset.c
new file mode 100644
index 0000000..125a2b6
--- /dev/null
+++ b/util/reset.c
@@ -0,0 +1,29 @@
+#include "cachepc/uapi.h"
+
+#include <sys/ioctl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <err.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int
+main(int argc, const char **argv)
+{
+ uint64_t arg;
+ int fd, ret;
+
+ fd = open("/dev/kvm", O_RDONLY);
+ if (fd < 0) err(1, "open");
+
+ ret = ioctl(fd, KVM_CPC_RESET_TRACKING);
+ if (ret) warn("ioctl RESET_TRACKING");
+
+ arg = 0;
+ ret = ioctl(fd, KVM_CPC_ACK_EVENT, &arg);
+ if (ret) warn("ioctl ACK_EVENT");
+
+ close(fd);
+}