{# Bus stats fragment — headline count + top talkers + top categories. Swapped by htmx alongside the frame log on refresh. #}
{% if not stats or stats.total_frames == 0 %}

Waiting for traffic — stats appear once frames land in the buffer.

{% else %}
{{ stats.total_frames }} frames buffered
span {{ '%.2f' | format(stats.span_seconds) }}s
Top talkers {% for row in stats.top_talkers %} {% endfor %}
{{ row.alias }} {{ row.count }}
Frame kinds {% for row in stats.top_categories %} {% endfor %}
{{ row.category }} {{ row.count }}
{% if stats.top_events %}
Top events (PCER) {% for row in stats.top_events %} {% endfor %}
{{ row.event }} {% if row.name %}
{{ row.name }}
{% endif %}
{{ row.count }}
{% endif %}
{% endif %}