0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00

ircd::ios: Add a queued handler counter to stats.

This commit is contained in:
Jason Volk 2019-04-10 22:52:33 -07:00
parent 1d45f0bc5b
commit 74778bd024
3 changed files with 11 additions and 1 deletions

View file

@ -97,6 +97,7 @@ struct ircd::ios::descriptor
struct ircd::ios::descriptor::stats struct ircd::ios::descriptor::stats
{ {
uint64_t queued {0};
uint64_t calls {0}; uint64_t calls {0};
uint64_t faults {0}; uint64_t faults {0};
uint64_t allocs {0}; uint64_t allocs {0};
@ -160,7 +161,10 @@ ircd::ios::handle<function>::handle(ios::descriptor &d,
function&& f) function&& f)
:handler{&d} :handler{&d}
,f{std::forward<function>(f)} ,f{std::forward<function>(f)}
{} {
assert(d.stats);
d.stats->queued++;
}
template<class function> template<class function>
template<class... args> template<class... args>
@ -168,6 +172,9 @@ void
ircd::ios::handle<function>::operator()(args&&... a) ircd::ios::handle<function>::operator()(args&&... a)
const const
{ {
assert(descriptor && descriptor->stats);
assert(descriptor->stats->queued > 0);
descriptor->stats->queued--;
f(std::forward<args>(a)...); f(std::forward<args>(a)...);
} }

View file

@ -175,6 +175,7 @@ struct ircd::ios::descriptor::stats &
ircd::ios::descriptor::stats::operator+=(const stats &o) ircd::ios::descriptor::stats::operator+=(const stats &o)
& &
{ {
queued += o.queued;
calls += o.calls; calls += o.calls;
faults += o.faults; faults += o.faults;
allocs += o.allocs; allocs += o.allocs;

View file

@ -837,6 +837,7 @@ console_cmd__ios(opt &out, const string_view &line)
<< " " << std::right << std::setw(10) << "FREES" << " " << std::right << std::setw(10) << "FREES"
<< " " << std::right << std::setw(26) << "ALLOCATED" << " " << std::right << std::setw(26) << "ALLOCATED"
<< " " << std::right << std::setw(26) << "FREED" << " " << std::right << std::setw(26) << "FREED"
<< " " << std::right << std::setw(8) << "QUEUED"
<< " " << std::right << std::setw(8) << "FAULTS" << " " << std::right << std::setw(8) << "FAULTS"
<< std::endl << std::endl
; ;
@ -852,6 +853,7 @@ console_cmd__ios(opt &out, const string_view &line)
<< " " << std::right << std::setw(10) << s.frees << " " << std::right << std::setw(10) << s.frees
<< " " << std::right << std::setw(26) << pretty(iec(s.alloc_bytes)) << " " << std::right << std::setw(26) << pretty(iec(s.alloc_bytes))
<< " " << std::right << std::setw(26) << pretty(iec(s.free_bytes)) << " " << std::right << std::setw(26) << pretty(iec(s.free_bytes))
<< " " << std::right << std::setw(8) << s.queued
<< " " << std::right << std::setw(8) << s.faults << " " << std::right << std::setw(8) << s.faults
; ;
}}; }};