bolar_2 backup
This commit is contained in:
59
host_tests/task_stack_budget_test.cc
Normal file
59
host_tests/task_stack_budget_test.cc
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "core/task_stack_budget.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace borla::task_stack_budget;
|
||||
|
||||
// Regression floors. Floors below must always be <= the budgets in
|
||||
// core/task_stack_budget.h; they exist to stop an accidental edit from
|
||||
// silently shrinking a stack below the last field-validated size.
|
||||
//
|
||||
// Connectivity-class budgets were re-derived from device high-water marks
|
||||
// taken after a full TLS + OTA + BLE provisioning cycle, because every
|
||||
// byte of those stacks is .bss and therefore comes off the front of the
|
||||
// main internal heap — the pool BLE provisioning exhausts when it re-inits
|
||||
// the WiFi driver next to the BT controller. Measured peak usage / floor
|
||||
// connectivity2 2492 / 5120 dual_network2 3136 / 4096
|
||||
// friend_service2 960 / 3072 alarm2 1172 / 3072
|
||||
// websocket2 5964 / 10240 (TLS handshake headroom)
|
||||
// capture2 ~6.3 KB measured / 10 KB budget (internal RAM)
|
||||
//
|
||||
// kCaptureEncoderBytes is NOT lowered with them: the 24 KB trim tripped
|
||||
// the stack canary inside silk_NSQ_del_dec_c (the opus_encode() chain
|
||||
// alone walked 24,240 bytes), so the floor stays at the last
|
||||
// field-validated 32 KB. That stack is PSRAM; headroom there is free.
|
||||
static_assert(kPlaybackBytes >= 36 * 1024);
|
||||
static_assert(kCaptureBytes >= 10 * 1024);
|
||||
static_assert(kConnectivityManagerBytes >= 5 * 1024);
|
||||
static_assert(kDualNetworkBytes >= 4 * 1024);
|
||||
static_assert(kWebsocketTransportBytes >= 10 * 1024);
|
||||
static_assert(kFriendServiceBytes >= 3 * 1024);
|
||||
static_assert(kAlarmServiceBytes >= 3 * 1024);
|
||||
static_assert(kRuntimeDiagnosticsBytes >= 8 * 1024);
|
||||
static_assert(kLocalPromptProducerBytes >= 6 * 1024);
|
||||
static_assert(kCaptureEncoderBytes >= 32 * 1024);
|
||||
|
||||
// The real-time ordering is the point, not the absolute numbers: the two
|
||||
// deadline-bound loops must outrank the codec, and capture must outrank
|
||||
// playback because it is the one that cannot be late without corrupting
|
||||
// the AEC's alignment.
|
||||
using namespace borla::task_priority;
|
||||
static_assert(kCaptureLoop > kPlaybackLoop);
|
||||
static_assert(kPlaybackLoop > kAudioCodec);
|
||||
|
||||
assert(kPlaybackBytes % 1024 == 0);
|
||||
assert(kCaptureBytes % 1024 == 0);
|
||||
assert(kConnectivityManagerBytes % 1024 == 0);
|
||||
assert(kDualNetworkBytes % 1024 == 0);
|
||||
assert(kWebsocketTransportBytes % 1024 == 0);
|
||||
assert(kFriendServiceBytes % 1024 == 0);
|
||||
assert(kAlarmServiceBytes % 1024 == 0);
|
||||
assert(kRuntimeDiagnosticsBytes % 1024 == 0);
|
||||
assert(kLocalPromptProducerBytes % 1024 == 0);
|
||||
|
||||
std::cout << "task stack budgets passed\n";
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user