diff options
| author | Louis Burda <quent.burda@gmail.com> | 2022-12-11 02:51:47 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2022-12-11 02:51:47 +0100 |
| commit | 5e99ea7f111134c7a1c7103590b711d59edafa9b (patch) | |
| tree | 0d27dc1e30a77123f31dc6dee678063f5258fe7d /util/reset.c | |
| parent | 05a4fbf680b806327a9c53525e9d8716dcdb55f3 (diff) | |
| download | cachepc-5e99ea7f111134c7a1c7103590b711d59edafa9b.tar.gz cachepc-5e99ea7f111134c7a1c7103590b711d59edafa9b.zip | |
Adding support for exec based tracking (unstable)
Diffstat (limited to 'util/reset.c')
| -rw-r--r-- | util/reset.c | 29 |
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); +} |
