Skip to content

Commit 935e792

Browse files
forgot .c files in last commit
1 parent 1f2ee09 commit 935e792

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

initial-xv6/tests/test_1.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "types.h"
2+
#include "stat.h"
3+
#include "user.h"
4+
5+
int
6+
main(int argc, char *argv[]) {
7+
int x1 = getreadcount();
8+
int x2 = getreadcount();
9+
char buf[100];
10+
(void) read(4, buf, 1);
11+
int x3 = getreadcount();
12+
int i;
13+
for (i = 0; i < 1000; i++) {
14+
(void) read(4, buf, 1);
15+
}
16+
int x4 = getreadcount();
17+
printf(1, "XV6_TEST_OUTPUT %d %d %d\n", x2-x1, x3-x2, x4-x3);
18+
exit();
19+
}

initial-xv6/tests/test_2.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include "types.h"
2+
#include "stat.h"
3+
#include "user.h"
4+
5+
int
6+
main(int argc, char *argv[]) {
7+
int x1 = getreadcount();
8+
9+
int rc = fork();
10+
11+
int total = 0;
12+
int i;
13+
for (i = 0; i < 100000; i++) {
14+
char buf[100];
15+
(void) read(4, buf, 1);
16+
}
17+
// https://wiki.osdev.org/Shutdown
18+
// (void) shutdown();
19+
20+
if (rc > 0) {
21+
(void) wait();
22+
int x2 = getreadcount();
23+
total += (x2 - x1);
24+
printf(1, "XV6_TEST_OUTPUT %d\n", total);
25+
}
26+
exit();
27+
}

0 commit comments

Comments
 (0)