Files
MaxScale/server/core/internal/server.hh
Markus Mäkelä c95adf1f2e Add prefix to Server member variables
Added the m_ prefix to Server member variables.
2018-09-28 12:18:24 +03:00

66 lines
1.6 KiB
C++

/*
* Copyright (c) 2018 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2022-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#pragma once
/**
* Internal header for the server type
*/
#include <maxbase/ccdefs.hh>
#include <mutex>
#include <maxbase/average.hh>
#include <maxscale/server.h>
#include <maxscale/resultset.hh>
#include <maxscale/routingworker.hh>
std::unique_ptr<ResultSet> serverGetList();
// Private server implementation
class Server : public SERVER
{
public:
Server()
: m_response_time(maxbase::EMAverage {0.04, 0.35, 500})
{
}
int response_time_num_samples() const
{
return m_response_time->num_samples();
}
double response_time_average() const
{
return m_response_time->average();
}
void response_time_add(double ave, int num_samples)
{
m_response_time->add(ave, num_samples);
}
mutable std::mutex m_lock;
private:
// nantti, TODO. Decide whether to expose some of this in config, or if the values
// can be calculated at runtime. The "500" or sample_max affects how often a
// session should updates this stat. sample_max should be slightly lower than max sample
// rate (which is less than qps due to the noise filter).
mxs::rworker_local<maxbase::EMAverage> m_response_time;
};
void server_free(Server* server);