0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::ctx: Profile peak stack usage at slice leave event.

This commit is contained in:
Jason Volk 2020-04-23 05:09:10 -07:00
parent 5a27958fa0
commit 32230ed2d4
3 changed files with 8 additions and 0 deletions

View file

@ -18,6 +18,7 @@ struct ircd::ctx::stack
uintptr_t base {0}; // assigned when spawned
size_t max {0}; // User given stack size
size_t at {0}; // Updated for profiling at sleep
size_t peak {0}; // Updated for profiling; maximum
stack(const size_t &max);

View file

@ -1759,6 +1759,7 @@ noexcept
c.ios_desc.stats->slice_total += last_slice;
c.ios_desc.stats->slice_last = last_slice;
c.stack.at = stack_at_here();
c.stack.peak = std::max(c.stack.at, c.stack.peak);
}
#ifndef NDEBUG

View file

@ -2411,6 +2411,9 @@ console_cmd__ctx__list(opt &out, const string_view &line)
<< "STACK"
<< " "
<< std::setw(25)
<< "PEAK"
<< " "
<< std::setw(25)
<< "LIMIT"
<< " "
<< std::setw(6)
@ -2461,6 +2464,9 @@ console_cmd__ctx__list(opt &out, const string_view &line)
out << " "
<< std::setw(25) << std::right << pretty(pbuf, iec(ctx::stack::get(ctx).at));
out << " "
<< std::setw(25) << std::right << pretty(pbuf, iec(ctx::stack::get(ctx).peak));
out << " "
<< std::setw(25) << std::right << pretty(pbuf, iec(ctx::stack::get(ctx).max));