mirror of
https://github.com/esphome/esphome.git
synced 2025-10-31 23:21:54 +00:00
debug logging
This commit is contained in:
@@ -91,9 +91,15 @@ void HOT Scheduler::set_timer_common_(Component *component, SchedulerItem::Type
|
|||||||
// Reuse from pool
|
// Reuse from pool
|
||||||
item = std::move(this->scheduler_item_pool_.back());
|
item = std::move(this->scheduler_item_pool_.back());
|
||||||
this->scheduler_item_pool_.pop_back();
|
this->scheduler_item_pool_.pop_back();
|
||||||
|
#ifdef ESPHOME_DEBUG_SCHEDULER
|
||||||
|
ESP_LOGVV(TAG, "Reused item from pool (pool size now: %zu)", this->scheduler_item_pool_.size());
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Allocate new if pool is empty
|
// Allocate new if pool is empty
|
||||||
item = make_unique<SchedulerItem>();
|
item = make_unique<SchedulerItem>();
|
||||||
|
#ifdef ESPHOME_DEBUG_SCHEDULER
|
||||||
|
ESP_LOGVV(TAG, "Allocated new item (pool empty)");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
item->component = component;
|
item->component = component;
|
||||||
item->set_name(name_cstr, !is_static_string);
|
item->set_name(name_cstr, !is_static_string);
|
||||||
@@ -771,6 +777,13 @@ void Scheduler::recycle_item_(std::unique_ptr<SchedulerItem> item) {
|
|||||||
// Clear dynamic name if any
|
// Clear dynamic name if any
|
||||||
item->clear_dynamic_name();
|
item->clear_dynamic_name();
|
||||||
this->scheduler_item_pool_.push_back(std::move(item));
|
this->scheduler_item_pool_.push_back(std::move(item));
|
||||||
|
#ifdef ESPHOME_DEBUG_SCHEDULER
|
||||||
|
ESP_LOGVV(TAG, "Recycled item to pool (pool size now: %zu)", this->scheduler_item_pool_.size());
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
#ifdef ESPHOME_DEBUG_SCHEDULER
|
||||||
|
ESP_LOGVV(TAG, "Pool full (size: %zu), deleting item", this->scheduler_item_pool_.size());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// else: unique_ptr will delete the item when it goes out of scope
|
// else: unique_ptr will delete the item when it goes out of scope
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user