summaryrefslogtreecommitdiffstats
path: root/test/eviction.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-01-21 02:23:52 +0100
committerLouis Burda <quent.burda@gmail.com>2023-01-21 02:23:52 +0100
commit769e05dd63ed0379e7325da6e82c0c46c151ef4e (patch)
tree0c0bbef5f61717647efb297b2632c3e92acc4089 /test/eviction.c
parent0257ca8ac931775fffd74150b439eb9ddcc025aa (diff)
downloadcachepc-769e05dd63ed0379e7325da6e82c0c46c151ef4e.tar.gz
cachepc-769e05dd63ed0379e7325da6e82c0c46c151ef4e.zip
Reimplement test and prime+probe in asm, make self-tests harder and improve noise
Diffstat (limited to 'test/eviction.c')
-rw-r--r--test/eviction.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/eviction.c b/test/eviction.c
index 69103af..fc11630 100644
--- a/test/eviction.c
+++ b/test/eviction.c
@@ -1,3 +1,4 @@
+#include "test/util.h"
#include "cachepc/uapi.h"
#include <sys/ioctl.h>
@@ -14,7 +15,7 @@ main(int argc, const char **argv)
{
uint8_t counts[L1_SETS];
uint32_t set;
- int i, fd, ret;
+ int fd, ret;
fd = open("/dev/kvm", O_RDONLY);
if (fd < 0) err(1, "open");
@@ -30,16 +31,9 @@ main(int argc, const char **argv)
ret = ioctl(fd, KVM_CPC_READ_COUNTS, counts);
if (ret == -1) err(1, "ioctl KVM_CPC_READ_COUNTS");
- for (i = 0; i < 64; i++) {
- if (i % 16 == 0 && i)
- printf("\n");
- if (counts[i] > 0)
- printf("\x1b[91m");
- printf("%2i ", i);
- if (counts[i] > 0)
- printf("\x1b[0m");
- }
+ print_counts(counts);
printf("\n");
+ print_counts_raw(counts);
close(fd);
}