3#ifdef USE_RUNTIME_STATS
10namespace runtime_stats {
17 if (component ==
nullptr)
38 ESP_LOGI(TAG,
"Component Runtime Statistics");
39 ESP_LOGI(TAG,
"Period stats (last %" PRIu32
"ms):", this->
log_interval_);
42 std::vector<ComponentStatPair> stats_to_display;
48 stats_to_display.push_back(pair);
53 std::sort(stats_to_display.begin(), stats_to_display.end(), std::greater<ComponentStatPair>());
56 for (
const auto &it : stats_to_display) {
57 const char *source = it.name;
60 ESP_LOGI(TAG,
" %s: count=%" PRIu32
", avg=%.2fms, max=%" PRIu32
"ms, total=%" PRIu32
"ms", source,
66 ESP_LOGI(TAG,
"Total stats (since boot):");
69 std::sort(stats_to_display.begin(), stats_to_display.end(),
71 return a.stats->get_total_time_ms() > b.stats->get_total_time_ms();
74 for (
const auto &it : stats_to_display) {
75 const char *source = it.name;
78 ESP_LOGI(TAG,
" %s: count=%" PRIu32
", avg=%.2fms, max=%" PRIu32
"ms, total=%" PRIu32
"ms", source,
const char * get_component_source() const
Get the integration where this component was declared as a string.
uint32_t get_period_max_time_ms() const
uint32_t get_total_time_ms() const
uint32_t get_total_max_time_ms() const
float get_period_avg_time_ms() const
float get_total_avg_time_ms() const
uint32_t get_period_time_ms() const
uint32_t get_period_count() const
uint32_t get_total_count() const
std::map< const char *, ComponentRuntimeStats, CStrCompare > component_stats_
void record_component_time(Component *component, uint32_t duration_ms, uint32_t current_time)
std::map< Component *, const char * > component_names_cache_
void process_pending_stats(uint32_t current_time)
Providing packet encoding functions for exchanging data with a remote host.
runtime_stats::RuntimeStatsCollector * global_runtime_stats