-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (32 loc) · 948 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
40
// #define _RESTORE
#include <iostream>
#include "Crawler.h"
#include "Crawler.cpp"
// gives a Crawler object named `myCrawler` from default
int main(int argc, const char *argv[])
{
srand(time(0));
// Crawler: maxLinks pagesLimit threads
myCrawler.maxLinks = stoi(argv[1]);
myCrawler.maxPages = stoi(argv[2]);
myCrawler.maxThreads = stoi(argv[3]);
myCrawler.max_file_size = stoi(argv[4]);
myCrawler.time_out = stoi(argv[5]);
myCrawler.SAVE_DATA = stoi(argv[6]);
myCrawler.RESTORE_DATA = stoi(argv[7]);
clock_t t1, t2;
t1 = clock();
myCrawler.initialize();
myCrawler.runCrawler();
// myCrawler.ranker();
myCrawler.showResults();
myCrawler.terminate();
t2 = clock();
double res = double(t2 - t1) * 1000 / CLOCKS_PER_SEC;
cout << "FINISHED." << endl;
cout << RED << "Elapsed time in milliseconds : "
<< res << RESET << endl;
cout << myCrawler.SAVE_DATA << endl;
cout << myCrawler.RESTORE_DATA << endl;
return 0;
}