forgot .c files in last commit

This commit is contained in:
Remzi Arpaci-Dusseau
2019-03-29 06:58:32 -05:00
parent 1f2ee09b27
commit 935e792457
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#include "types.h"
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[]) {
int x1 = getreadcount();
int x2 = getreadcount();
char buf[100];
(void) read(4, buf, 1);
int x3 = getreadcount();
int i;
for (i = 0; i < 1000; i++) {
(void) read(4, buf, 1);
}
int x4 = getreadcount();
printf(1, "XV6_TEST_OUTPUT %d %d %d\n", x2-x1, x3-x2, x4-x3);
exit();
}

View File

@@ -0,0 +1,27 @@
#include "types.h"
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[]) {
int x1 = getreadcount();
int rc = fork();
int total = 0;
int i;
for (i = 0; i < 100000; i++) {
char buf[100];
(void) read(4, buf, 1);
}
// https://wiki.osdev.org/Shutdown
// (void) shutdown();
if (rc > 0) {
(void) wait();
int x2 = getreadcount();
total += (x2 - x1);
printf(1, "XV6_TEST_OUTPUT %d\n", total);
}
exit();
}