-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
30 lines (22 loc) · 725 Bytes
/
Copy pathmain.cpp
File metadata and controls
30 lines (22 loc) · 725 Bytes
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
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "loadbalancer.h"
int main() {
srand(static_cast<unsigned int>(time(0)));
int numServers, runTime;
std::cout << "Enter the number of servers: ";
std::cin >> numServers;
std::cout << "Enter the total runtime (in clock cycles): ";
std::cin >> runTime;
LoadBalancer lb(numServers);
for (int i = 0; i < numServers * 100; ++i) {
std::string ip_in = "192.168.0." + std::to_string(rand() % 256);
std::string ip_out = "10.0.0." + std::to_string(rand() % 256);
int time = rand() % 100 + 1;
Request req(ip_in, ip_out, time);
lb.addRequest(req);
}
lb.run(runTime);
return 0;
}