ref: 02f047daee598f22e641365d01934973b14f89f3
parent: c2c6b68ac66d44ec8e38e205d2f1cb66a458e359
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Oct 28 08:49:43 EDT 2020
wire to cpu 0, remove memmove benchmarks
--- a/main.c
+++ b/main.c
@@ -12,15 +12,25 @@
void
threadmain(int argc, char **argv)
{
- B group[10], *b;
+ B *group, *b;
uchar d[1];
+ char t[64];
int f;
ARGBEGIN{
}ARGEND
- b = &group[0];
+ snprint(t, sizeof(t), "/proc/%d/ctl", getpid());
+ if((f = open(t, OWRITE)) < 0)
+ fprint(2, "%r\n");
+ else{
+ if(write(f, "wired 0\n", 8) != 8)
+ fprint(2, "failed to wire\n");
+ close(f);
+ }
+ b = group = malloc(32 * sizeof(*b));
+
f = open("/dev/null", OREAD);
benchinit(b, "read/1");
while(b->n > 0){
@@ -79,45 +89,8 @@
}
b++;
- benchinit(b, "memmove(4k)");
- while(b->n > 0){
- char *x, *y;
- x = malloc(4096);
- y = malloc(4096);
- benchin(b);
- memmove(x, y, 4096);
- benchout(b);
- free(x);
- free(y);
- }
- b++;
- benchinit(b, "memmove(64k)");
- while(b->n > 0){
- char *x, *y;
- x = malloc(65536);
- y = malloc(65536);
- benchin(b);
- memmove(x, y, 65536);
- benchout(b);
- free(x);
- free(y);
- }
-
- b++;
- benchinit(b, "memmove(256k)");
- while(b->n > 0){
- char *x, *y;
- x = malloc(256*1024);
- y = malloc(256*1024);
- benchin(b);
- memmove(x, y, 256*1024);
- benchout(b);
- free(x);
- free(y);
- }
-
- benchprint(group, nelem(group), 1);
+ benchprint(group, b-group, 1);
threadexitsall(nil);
}