Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
remzi-arpacidusseau
GitHub Repository: remzi-arpacidusseau/ostep-projects
Path: blob/master/initial-xv6/tests/test_2.c
909 views
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
}
28
29