Inline backend related functions

Inlined the getter/setter type functions that are often used. Profiling
shows that inlining the RWBackend get/set functions for the reply state
manipulation reduces the relative cost of the function to acceptable
levels. Inlining the Backend state function did not have as large an
effect but it appears contribute a slight performance boost.
This commit is contained in:
Markus Mäkelä
2017-10-05 17:49:50 +03:00
parent 9ece996466
commit 8bcd30ea7c
5 changed files with 88 additions and 119 deletions

View File

@ -173,23 +173,6 @@ void Backend::set_state(backend_state state)
m_state |= state;
}
SERVER_REF* Backend::backend() const
{
ss_dassert(m_backend);
return m_backend;
}
SERVER* Backend::server() const
{
ss_dassert(m_backend);
return m_backend->server;
}
bool Backend::can_connect() const
{
return !has_failed() && SERVER_IS_RUNNING(m_backend->server);
}
bool Backend::connect(MXS_SESSION* session)
{
bool rval = false;
@ -209,11 +192,6 @@ bool Backend::connect(MXS_SESSION* session)
return rval;
}
DCB* Backend::dcb() const
{
return m_dcb;
}
bool Backend::write(GWBUF* buffer, response_type type)
{
bool rval = m_dcb->func.write(m_dcb, buffer) != 0;
@ -266,53 +244,3 @@ bool Backend::write_stored_command()
return rval;
}
bool Backend::in_use() const
{
return m_state & IN_USE;
}
bool Backend::is_active() const
{
return SERVER_REF_IS_ACTIVE(m_backend);
}
bool Backend::is_waiting_result() const
{
return m_state & WAITING_RESULT;
}
bool Backend::is_closed() const
{
return m_closed;
}
bool Backend::is_master() const
{
return SERVER_IS_MASTER(m_backend->server);
}
bool Backend::is_slave() const
{
return SERVER_IS_SLAVE(m_backend->server);
}
bool Backend::is_relay() const
{
return SERVER_IS_RELAY_SERVER(m_backend->server);
}
bool Backend::has_failed() const
{
return m_state & FATAL_FAILURE;
}
const char* Backend::name() const
{
return m_backend->server->unique_name;
}
const char* Backend::uri() const
{
return m_uri.c_str();
}