0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

ircd::ctx: Use a pseudo ios::descriptor to include contexts in ircd::ios.

This commit is contained in:
Jason Volk 2019-07-21 17:55:58 -07:00
parent d18a1acf43
commit e36a3035a4
2 changed files with 13 additions and 1 deletions

View file

@ -38,6 +38,12 @@ ircd::ctx::ctx::id_ctr
0 0
}; };
decltype(ircd::ctx::ctx::ios_desc)
ircd::ctx::ctx::ios_desc
{
"ircd::ctx::ctx"
};
/// Spawn (internal) /// Spawn (internal)
void void
IRCD_CTX_STACK_PROTECT IRCD_CTX_STACK_PROTECT
@ -1654,6 +1660,8 @@ ircd::ctx::prof::handle_cur_continue()
void void
ircd::ctx::prof::slice_enter() ircd::ctx::prof::slice_enter()
{ {
assert(ctx::ios_desc.stats);
++ctx::ios_desc.stats->calls;
_slice_start = cycles(); _slice_start = cycles();
assert(_slice_start >= _slice_stop); assert(_slice_start >= _slice_stop);
} }
@ -1675,8 +1683,11 @@ ircd::ctx::prof::slice_leave()
size_t(prof::event::CYCLES) size_t(prof::event::CYCLES)
}; };
c.profile.event.at(pos) += last_slice;
_total.event.at(pos) += last_slice; _total.event.at(pos) += last_slice;
c.profile.event.at(pos) += last_slice;
assert(c.ios_desc.stats);
c.ios_desc.stats->slice_total += last_slice;
c.ios_desc.stats->slice_last = last_slice;
c.stack.at = stack_at_here(); c.stack.at = stack_at_here();
} }

View file

@ -49,6 +49,7 @@ struct ircd::ctx::ctx
:instance_list<ctx> :instance_list<ctx>
{ {
static uint64_t id_ctr; // monotonic static uint64_t id_ctr; // monotonic
static ios::descriptor ios_desc;
uint64_t id {++id_ctr}; // Unique runtime ID uint64_t id {++id_ctr}; // Unique runtime ID
string_view name; // User given name (optional) string_view name; // User given name (optional)