mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::net::socket: Convert totals counters to stats::items.
This commit is contained in:
parent
13d733e89d
commit
0f4d1e2869
2 changed files with 46 additions and 21 deletions
|
@ -48,7 +48,10 @@ struct ircd::net::socket
|
|||
|
||||
static uint64_t count; // monotonic
|
||||
static uint64_t instances; // current socket count
|
||||
static stat in_total, out_total;
|
||||
static stats::item total_bytes_in;
|
||||
static stats::item total_bytes_out;
|
||||
static stats::item total_calls_in;
|
||||
static stats::item total_calls_out;
|
||||
|
||||
uint64_t id {++count};
|
||||
ip::tcp::socket sd;
|
||||
|
|
62
ircd/net.cc
62
ircd/net.cc
|
@ -2697,11 +2697,33 @@ decltype(ircd::net::socket::instances)
|
|||
ircd::net::socket::instances
|
||||
{};
|
||||
|
||||
decltype(ircd::net::socket::in_total)
|
||||
ircd::net::socket::in_total;
|
||||
decltype(ircd::net::socket::total_bytes_in)
|
||||
ircd::net::socket::total_bytes_in
|
||||
{
|
||||
{ "name", "ircd.net.socket.in.total.bytes" },
|
||||
{ "desc", "The total number of bytes received by all sockets" },
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::out_total)
|
||||
ircd::net::socket::out_total;
|
||||
decltype(ircd::net::socket::total_bytes_out)
|
||||
ircd::net::socket::total_bytes_out
|
||||
{
|
||||
{ "name", "ircd.net.socket.out.total.bytes" },
|
||||
{ "desc", "The total number of bytes received by all sockets" },
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::total_calls_in)
|
||||
ircd::net::socket::total_calls_in
|
||||
{
|
||||
{ "name", "ircd.net.socket.in.total.calls" },
|
||||
{ "desc", "The total number of read operations on all sockets" },
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::total_calls_out)
|
||||
ircd::net::socket::total_calls_out
|
||||
{
|
||||
{ "name", "ircd.net.socket.out.total.calls" },
|
||||
{ "desc", "The total number of write operations on all sockets" },
|
||||
};
|
||||
|
||||
//
|
||||
// socket
|
||||
|
@ -3193,8 +3215,8 @@ try
|
|||
|
||||
++in.calls;
|
||||
in.bytes += ret;
|
||||
++in_total.calls;
|
||||
in_total.bytes += ret;
|
||||
++total_calls_in;
|
||||
total_bytes_in += ret;
|
||||
return ret;
|
||||
}
|
||||
catch(const boost::system::system_error &e)
|
||||
|
@ -3231,8 +3253,8 @@ try
|
|||
|
||||
++in.calls;
|
||||
in.bytes += ret;
|
||||
++in_total.calls;
|
||||
in_total.bytes += ret;
|
||||
++total_calls_in;
|
||||
total_bytes_in += ret;
|
||||
return ret;
|
||||
}
|
||||
catch(const boost::system::system_error &e)
|
||||
|
@ -3259,8 +3281,8 @@ ircd::net::socket::read_any(iov&& bufs)
|
|||
|
||||
++in.calls;
|
||||
in.bytes += ret;
|
||||
++in_total.calls;
|
||||
in_total.bytes += ret;
|
||||
++total_calls_in;
|
||||
total_bytes_in += ret;
|
||||
|
||||
if(likely(!ec))
|
||||
return ret;
|
||||
|
@ -3287,8 +3309,8 @@ ircd::net::socket::read_one(iov&& bufs)
|
|||
|
||||
++in.calls;
|
||||
in.bytes += ret;
|
||||
++in_total.calls;
|
||||
in_total.bytes += ret;
|
||||
++total_calls_in;
|
||||
total_bytes_in += ret;
|
||||
|
||||
if(likely(!ec))
|
||||
return ret;
|
||||
|
@ -3328,8 +3350,8 @@ try
|
|||
|
||||
++out.calls;
|
||||
out.bytes += ret;
|
||||
++out_total.calls;
|
||||
out_total.bytes += ret;
|
||||
++total_calls_out;
|
||||
total_bytes_out += ret;
|
||||
return ret;
|
||||
}
|
||||
catch(const boost::system::system_error &e)
|
||||
|
@ -3360,8 +3382,8 @@ try
|
|||
|
||||
++out.calls;
|
||||
out.bytes += ret;
|
||||
++out_total.calls;
|
||||
out_total.bytes += ret;
|
||||
++total_calls_out;
|
||||
total_bytes_out += ret;
|
||||
return ret;
|
||||
}
|
||||
catch(const boost::system::system_error &e)
|
||||
|
@ -3388,8 +3410,8 @@ try
|
|||
|
||||
++out.calls;
|
||||
out.bytes += ret;
|
||||
++out_total.calls;
|
||||
out_total.bytes += ret;
|
||||
++total_calls_out;
|
||||
total_bytes_out += ret;
|
||||
return ret;
|
||||
}
|
||||
catch(const boost::system::system_error &e)
|
||||
|
@ -3411,8 +3433,8 @@ try
|
|||
|
||||
++out.calls;
|
||||
out.bytes += ret;
|
||||
++out_total.calls;
|
||||
out_total.bytes += ret;
|
||||
++total_calls_out;
|
||||
total_bytes_out += ret;
|
||||
return ret;
|
||||
}
|
||||
catch(const boost::system::system_error &e)
|
||||
|
|
Loading…
Reference in a new issue