This commit is contained in:
J. Nick Koston 2025-07-08 11:10:32 -06:00
parent ae346bb94e
commit d32db20aa0
No known key found for this signature in database
2 changed files with 2 additions and 4 deletions

View File

@ -25,17 +25,13 @@ void RuntimeStatsCollector::record_component_time(Component *component, uint32_t
this->component_names_cache_[component] = source;
this->component_stats_[source].record_time(duration_ms);
} else {
// Use cached name - no string operations, just map lookup
this->component_stats_[name_it->second].record_time(duration_ms);
}
// If next_log_time_ is 0, initialize it
if (this->next_log_time_ == 0) {
this->next_log_time_ = current_time + this->log_interval_;
return;
}
// Don't print stats here anymore - let process_pending_stats handle it
}
void RuntimeStatsCollector::log_stats_() {

View File

@ -111,6 +111,8 @@ class RuntimeStatsCollector {
// Use const char* keys for efficiency
// Custom comparator for const char* keys in map
// Without this, std::map would compare pointer addresses instead of string contents,
// causing identical component names at different addresses to be treated as different keys
struct CStrCompare {
bool operator()(const char *a, const char *b) const { return std::strcmp(a, b) < 0; }
};