Make the Server's EMAverage a member

The combined effort of all workers of updating EMAverage is needed for precision,
statistics and making parts of it adaptive (rather than hardcoded or configured).
This commit is contained in:
Niclas Antti
2018-10-03 18:32:13 +03:00
parent ada91f2d53
commit 19f8e1697b
2 changed files with 12 additions and 4 deletions

View File

@ -1535,9 +1535,17 @@ bool server_set_disk_space_threshold(SERVER* server, const char* disk_space_thre
return rv;
}
namespace
{
std::mutex ave_write_mutex;
}
void server_add_response_average(SERVER* srv, double ave, int num_samples)
{
Server* server = static_cast<Server*>(srv);
std::lock_guard<std::mutex> guard(ave_write_mutex);
server->response_time_add(ave, num_samples);
}