Add broker and web throughput diagnostics
This commit is contained in:
@@ -149,6 +149,10 @@ static void fan_out_rx_locked(const uint8_t *data, size_t size)
|
||||
|
||||
slot->counters.uart_rx_bytes += size;
|
||||
size_t queued = xStreamBufferSend(slot->output, data, size, 0);
|
||||
size_t pending = xStreamBufferBytesAvailable(slot->output);
|
||||
if (pending > slot->counters.output_high_water_bytes) {
|
||||
slot->counters.output_high_water_bytes = pending;
|
||||
}
|
||||
size_t dropped = size - queued;
|
||||
slot->counters.output_queued_bytes += queued;
|
||||
slot->counters.output_dropped_bytes += dropped;
|
||||
@@ -740,6 +744,8 @@ esp_err_t session_broker_clear_counters(void)
|
||||
memset(&s_counters, 0, sizeof(s_counters));
|
||||
for (size_t i = 0; i < SESSION_BROKER_MAX_CLIENTS; ++i) {
|
||||
memset(&s_slots[i].counters, 0, sizeof(s_slots[i].counters));
|
||||
s_slots[i].counters.output_high_water_bytes =
|
||||
xStreamBufferBytesAvailable(s_slots[i].output);
|
||||
}
|
||||
xSemaphoreGive(s_mutex);
|
||||
return ESP_OK;
|
||||
@@ -758,6 +764,7 @@ esp_err_t session_broker_clear_client_counters(session_broker_client_id_t client
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
memset(&slot->counters, 0, sizeof(slot->counters));
|
||||
slot->counters.output_high_water_bytes = xStreamBufferBytesAvailable(slot->output);
|
||||
xSemaphoreGive(s_mutex);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user