0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

ircd::ctx: Expose stack usage functions to user.

This commit is contained in:
Jason Volk 2017-08-31 17:42:15 -07:00
parent cbdd176819
commit f98be1582d
2 changed files with 14 additions and 2 deletions

View file

@ -24,6 +24,12 @@
#pragma once
#define HAVE_IRCD_CTX_PROF_H
namespace ircd::ctx
{
size_t stack_usage_here(const ctx &) __attribute__((noinline));
size_t stack_usage_here() __attribute__((noinline));
}
/* Profiling for the context system. These facilities provide tools and statistics.
* The primary purpose here is to alert developers of unwanted context behavior, in
* addition to optimizing the overall performance of the context system.

View file

@ -617,7 +617,6 @@ namespace ircd::ctx::prof
{
time_point cur_slice_start; // Time slice state
size_t stack_usage_here(const ctx &) __attribute__((noinline));
void check_stack();
void check_slice();
void slice_start();
@ -726,7 +725,14 @@ ircd::ctx::prof::check_stack()
}
size_t
ircd::ctx::prof::stack_usage_here(const ctx &ctx)
ircd::ctx::stack_usage_here()
{
assert(current);
return stack_usage_here(*current);
}
size_t
ircd::ctx::stack_usage_here(const ctx &ctx)
{
return ctx.stack_base - uintptr_t(__builtin_frame_address(0));
}