summaryrefslogtreecommitdiffstats
path: root/access.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2022-08-08 19:21:29 +0200
committerLouis Burda <quent.burda@gmail.com>2022-08-08 19:21:46 +0200
commitd8a20a54b05e2c9adb5198b1439608391450dd0b (patch)
treeb6c1e472df9ceb5923d0aee4d77443b942023f62 /access.c
parent576e8dc70825a04af3ac9890491d348959bf19ce (diff)
downloadcachepc-d8a20a54b05e2c9adb5198b1439608391450dd0b.tar.gz
cachepc-d8a20a54b05e2c9adb5198b1439608391450dd0b.zip
Added ioctl interface and debuged single access evictions
Diffstat (limited to 'access.c')
-rw-r--r--access.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/access.c b/access.c
new file mode 100644
index 0000000..1f16552
--- /dev/null
+++ b/access.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <err.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stropts.h>
+
+#include "cachepc_user.h"
+
+int
+main(int argc, const char **argv)
+{
+ size_t i, len;
+ int fd, ret;
+ int count;
+
+ fd = open("/proc/cachepc", O_RDONLY);
+ if (fd < 0) err(1, "open");
+
+ for (i = 0; i < 50; i++) {
+ ret = ioctl(fd, CACHEPC_IOCTL_ACCESS_TEST, &count);
+ if (ret == -1) err(1, "ioctl fail");
+ printf("%i\n", count);
+ }
+
+ close(fd);
+}