25 if (
component->runtime_stats_.period_count > 0) {
31 "Component Runtime Statistics\n"
32 " Period stats (last %" PRIu32
"ms): %zu active components",
40 uint64_t period_component_sum_us = 0;
41 for (
size_t i = 0; i < count; i++) {
44 uint64_t total_component_sum_us = 0;
46 total_component_sum_us +=
component->runtime_stats_.total_time_us;
54 for (
size_t i = 0; i < count; i++) {
56 ESP_LOGI(TAG,
" %s: count=%" PRIu32
", avg=%.3fms, max=%.2fms, total=%.1fms",
57 LOG_STR_ARG(sorted[i]->get_component_log_str()), stats.period_count,
58 stats.period_count > 0 ? stats.period_time_us / (
float) stats.period_count / 1000.0f : 0.0f,
59 stats.period_max_time_us / 1000.0f, stats.period_time_us / 1000.0f);
67 uint64_t overhead = active > period_component_sum_us ? active - period_component_sum_us : 0;
71 " main_loop: iters=%" PRIu64
", active_avg=%.3fms, active_max=%.2fms, active_total=%.1fms, "
72 "overhead_total=%.1fms",
76 static_cast<double>(overhead) / 1000.0);
79 uint64_t accounted = before + tail;
80 uint64_t inter = overhead > accounted ? overhead - accounted : 0;
81 ESP_LOGI(TAG,
" main_loop_overhead_section: before=%.1fms, tail=%.1fms, inter_component=%.1fms",
82 static_cast<double>(before) / 1000.0,
static_cast<double>(tail) / 1000.0,
83 static_cast<double>(inter) / 1000.0);
87 ESP_LOGI(TAG,
" Total stats (since boot): %zu active components", count);
93 for (
size_t i = 0; i < count; i++) {
95 ESP_LOGI(TAG,
" %s: count=%" PRIu32
", avg=%.3fms, max=%.2fms, total=%.1fms",
96 LOG_STR_ARG(sorted[i]->get_component_log_str()), stats.total_count,
97 stats.total_count > 0 ? stats.total_time_us / (
float) stats.total_count / 1000.0f : 0.0f,
98 stats.total_max_time_us / 1000.0f, stats.total_time_us / 1000.0);
104 uint64_t overhead = active > total_component_sum_us ? active - total_component_sum_us : 0;
106 " main_loop: iters=%" PRIu64
", active_avg=%.3fms, active_max=%.2fms, active_total=%.1fms, "
107 "overhead_total=%.1fms",
111 static_cast<double>(overhead) / 1000.0);
114 uint64_t accounted = before + tail;
115 uint64_t inter = overhead > accounted ? overhead - accounted : 0;
116 ESP_LOGI(TAG,
" main_loop_overhead_section: before=%.1fms, tail=%.1fms, inter_component=%.1fms",
117 static_cast<double>(before) / 1000.0,
static_cast<double>(tail) / 1000.0,
118 static_cast<double>(inter) / 1000.0);
123 component->runtime_stats_.reset_period();