fix tabbing
This commit is contained in:
parent
036b50b979
commit
4d96d858a5
54
main.cpp
54
main.cpp
@ -71,33 +71,33 @@ auto execute_as_client(std::string ipaddress, std::uint16_t port)
|
|||||||
for(int i = 0; i < num_clients; ++i)
|
for(int i = 0; i < num_clients; ++i)
|
||||||
{
|
{
|
||||||
threads.emplace_back(std::thread([&]()
|
threads.emplace_back(std::thread([&]()
|
||||||
{
|
{
|
||||||
client net_client{};
|
client net_client{};
|
||||||
metrics::time_tracker clock{};
|
metrics::time_tracker clock{};
|
||||||
//Callback
|
//Callback
|
||||||
net_client.message_received += [&](std::string& message)
|
net_client.message_received += [&](std::string& message)
|
||||||
{
|
{
|
||||||
auto elapsed = clock.elapsed<double, std::milli>();
|
auto elapsed = clock.elapsed<double, std::milli>();
|
||||||
auto client_num = this_job.client_metrics.size()+1;
|
auto client_num = this_job.client_metrics.size()+1;
|
||||||
//UX
|
//UX
|
||||||
sscout << client_num << math::numerical_suffix(client_num) << " client response\n"
|
sscout << client_num << math::numerical_suffix(client_num) << " client response\n"
|
||||||
<< message
|
<< message
|
||||||
<< "Round Trip Was " << elapsed.count() << " ms\n"
|
<< "Round Trip Was " << elapsed.count() << " ms\n"
|
||||||
<< hr;
|
<< hr;
|
||||||
//Metrics
|
//Metrics
|
||||||
metrics::client_message client_metric{};
|
metrics::client_message client_metric{};
|
||||||
client_metric.client_number = client_num;
|
client_metric.client_number = client_num;
|
||||||
client_metric.trip_time = elapsed.count();
|
client_metric.trip_time = elapsed.count();
|
||||||
this_job.client_metrics.emplace_back(client_metric); //this isn't thread safe!
|
this_job.client_metrics.emplace_back(client_metric); //this isn't thread safe!
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
auto res = net_client.connect(ipaddress, port);
|
auto res = net_client.connect(ipaddress, port);
|
||||||
if (res.joinable())
|
if (res.joinable())
|
||||||
{
|
{
|
||||||
net_client.send_message(std::to_string(operation));
|
net_client.send_message(std::to_string(operation));
|
||||||
res.join();
|
res.join();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
sscout << "All clients connected.\n" << hr;
|
sscout << "All clients connected.\n" << hr;
|
||||||
for(auto&& thread : threads)
|
for(auto&& thread : threads)
|
||||||
|
Loading…
Reference in New Issue
Block a user