forked from mit-pdos/xv6-public
-
Notifications
You must be signed in to change notification settings - Fork 12
/
pgswptest.c
36 lines (30 loc) · 827 Bytes
/
pgswptest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "types.h"
#include "stat.h"
#include "user.h"
void rec(int n)
{
if (n == 0)
{
printf(1, "Recursion exit.\n");
return;
}
else if (n % 50 == 0 || n < 100)
printf(1, "Recursion level %d\n", n);
int array[16384];
int i;
for (i = 0; i < 16384; i++)
(void)(array[i] = i);
rec(n - 1);
}
int main()
{
printf(1, "================================\n");
printf(1, "Page swapping test started.\n");
// This is a magic number, we only have a few swapping memory.
// If the level is set too big, will use out swapfile.
// If too small, will not trigger page swapping function.
rec(532);
printf(1, "Page swapping test finished.\n");
printf(1, "================================\n");
return 0;
}