-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
39 lines (35 loc) · 935 Bytes
/
main.cpp
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
37
38
39
#include <iostream>
#include "page_cache_operator.h"
using namespace std;
int main(int argc, char *argv[])
{
if (argc == 1)
{
printf("usage : \n"
"1.clear page cache : ./main clear files;\n"
"2.load file to page cache : ./main all file;\n"
"3. x page in file is in page cache or not .\n");
}
PageCacheOperator pcOperator;
if (argc >= 3 && strcmp(argv[1], "clear") == 0)
{
for (uint32_t i = 2; i < argc; ++i)
{
pcOperator.clear_file_cache(argv[i]);
}
return -1;
}
if (argc >= 3 && strcmp(argv[1], "all") == 0)
{
for (uint32_t i = 2; i < argc; ++i)
{
pcOperator.LoadDataToPageCache(argv[i]);
}
}
else if (argc == 3)
{
pcOperator.PrintPageState(argv[2], atoi(argv[1]));
}
pcOperator.GetPageInfo(argv[2]);
return 0;
}