28 if (it.second.get_period_count() > 0) {
34 "Component Runtime Statistics\n"
35 " Period stats (last %" PRIu32
"ms): %zu active components",
48 for (
const auto &it : this->component_stats_) {
49 if (it.second.get_period_count() > 0) {
50 sorted[idx++] = it.first;
56 return this->component_stats_[a].get_period_time_us() > this->component_stats_[b].get_period_time_us();
60 for (
size_t i = 0; i < count; i++) {
61 const auto &stats = this->component_stats_[sorted[i]];
62 ESP_LOGI(TAG,
" %s: count=%" PRIu32
", avg=%.3fms, max=%.2fms, total=%.1fms",
63 LOG_STR_ARG(sorted[i]->get_component_log_str()), stats.get_period_count(),
64 stats.get_period_avg_time_us() / 1000.0f, stats.get_period_max_time_us() / 1000.0f,
65 stats.get_period_time_us() / 1000.0f);
69 ESP_LOGI(TAG,
" Total stats (since boot): %zu active components", count);
73 return this->component_stats_[a].get_total_time_us() > this->component_stats_[b].get_total_time_us();
76 for (
size_t i = 0; i < count; i++) {
77 const auto &stats = this->component_stats_[sorted[i]];
78 ESP_LOGI(TAG,
" %s: count=%" PRIu32
", avg=%.3fms, max=%.2fms, total=%.1fms",
79 LOG_STR_ARG(sorted[i]->get_component_log_str()), stats.get_total_count(),
80 stats.get_total_avg_time_us() / 1000.0f, stats.get_total_max_time_us() / 1000.0f,
81 stats.get_total_time_us() / 1000.0);