[api] Add send_sensor_state benchmarks

Add benchmarks for the full send_sensor_state path covering both
immediate send and batch paths. This measures the end-to-end cost
of sending a sensor state update through an APIConnection including
entity field population, proto encode, framing, and TCP write.
This commit is contained in:
J. Nick Koston
2026-04-01 07:42:58 -10:00
parent 212b3e1688
commit dcac526a34
2 changed files with 144 additions and 0 deletions
+4
View File
@@ -44,10 +44,14 @@ static constexpr size_t MAX_INITIAL_PER_BATCH = 34; // For clients >= AP
static_assert(MAX_MESSAGES_PER_BATCH >= MAX_INITIAL_PER_BATCH,
"MAX_MESSAGES_PER_BATCH must be >= MAX_INITIAL_PER_BATCH");
class APIConnection;
void bench_enable_immediate_send(APIConnection *conn); // tests/benchmarks
class APIConnection final : public APIServerConnectionBase {
public:
friend class APIServer;
friend class ListEntitiesIterator;
friend void bench_enable_immediate_send(APIConnection *conn);
APIConnection(std::unique_ptr<socket::Socket> socket, APIServer *parent);
~APIConnection();