mirror of https://github.com/arendst/Tasmota.git
Berry add stack increase observability (#13482)
* Berry add stack increase observability * Berry stack increase in bytes
This commit is contained in:
parent
f989063f29
commit
6158032723
|
@ -390,6 +390,10 @@ void be_stack_expansion(bvm *vm, int n)
|
|||
stack_resize(vm, size + 1);
|
||||
be_raise(vm, "runtime_error", STACK_OVER_MSG(BE_STACK_TOTAL_MAX));
|
||||
}
|
||||
#if BE_USE_OBSERVABILITY_HOOK
|
||||
if (vm->obshook != NULL)
|
||||
(*vm->obshook)(vm, BE_OBS_STACK_RESIZE_START, size * sizeof(bvalue), (size + n) * sizeof(bvalue));
|
||||
#endif
|
||||
stack_resize(vm, size + n);
|
||||
}
|
||||
|
||||
|
|
|
@ -405,6 +405,7 @@ enum beobshookevents {
|
|||
BE_OBS_GC_START, /* start of GC, arg = allocated size */
|
||||
BE_OBS_GC_END, /* end of GC, arg = allocated size */
|
||||
BE_OBS_VM_HEARTBEAT, /* VM heartbeat called every million instructions */
|
||||
BE_OBS_STACK_RESIZE_START, /* Berry stack resized */
|
||||
};
|
||||
|
||||
/* FFI functions */
|
||||
|
|
|
@ -268,6 +268,13 @@ void BerryObservability(bvm *vm, int event...) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case BE_OBS_STACK_RESIZE_START:
|
||||
{
|
||||
int32_t stack_before = va_arg(param, int32_t);
|
||||
int32_t stack_after = va_arg(param, int32_t);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_BERRY "Stack resized from %i to %i bytes"), stack_before, stack_after);
|
||||
}
|
||||
break;
|
||||
case BE_OBS_VM_HEARTBEAT:
|
||||
{
|
||||
// AddLog(LOG_LEVEL_INFO, ">>>: Heartbeat now=%i timeout=%i", millis(), berry.timeout);
|
||||
|
|
Loading…
Reference in New Issue