/* Measure Linux (or whatever) system call overhead: minimally about * 300 ns on this laptop. Copying 8192 zero bytes into userspace * seems to take about 1400 ns more, or 171 ps per byte. */ #include #include #include #include char *devzero = "/dev/zero"; int main(int argc, char **argv) { int n = atoi(argv[1]); size_t s = atoi(argv[2]); char c[s]; int fd = open(devzero, O_RDONLY); if (fd < 0) { perror(devzero); return 1; } for (int i = 0; i < n; i++) { read(fd, c, s); } return 0; }