mirror of
https://github.com/esphome/esphome.git
synced 2026-09-01 02:26:01 +00:00
Merge branch 'inline-finish-guard' into integration
This commit is contained in:
@@ -522,7 +522,7 @@ void PollingComponent::stop_poller() {
|
||||
uint32_t PollingComponent::get_update_interval() const { return this->update_interval_; }
|
||||
void PollingComponent::set_update_interval(uint32_t update_interval) { this->update_interval_ = update_interval; }
|
||||
|
||||
void __attribute__((noinline, cold)) warn_if_blocking(Component *component, uint32_t blocking_time) {
|
||||
void __attribute__((noinline, cold)) warn_blocking(Component *component, uint32_t blocking_time) {
|
||||
bool should_warn;
|
||||
if (component != nullptr) {
|
||||
should_warn = component->should_warn_of_blocking(blocking_time);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/optional.h"
|
||||
@@ -574,13 +575,10 @@ class PollingComponent : public Component {
|
||||
uint32_t update_interval_;
|
||||
};
|
||||
|
||||
uint32_t millis(); // Forward declare for inline finish()
|
||||
#ifdef USE_RUNTIME_STATS
|
||||
uint32_t micros(); // Forward declare for inline constructor
|
||||
#endif
|
||||
// millis() and micros() are available via hal.h
|
||||
|
||||
// Cold path for blocking warning - defined in component.cpp
|
||||
void warn_if_blocking(Component *component, uint32_t blocking_time);
|
||||
void warn_blocking(Component *component, uint32_t blocking_time);
|
||||
|
||||
class WarnIfComponentBlockingGuard {
|
||||
public:
|
||||
@@ -603,7 +601,7 @@ class WarnIfComponentBlockingGuard {
|
||||
this->record_runtime_stats_();
|
||||
#endif
|
||||
if (blocking_time > WARN_IF_BLOCKING_OVER_MS) [[unlikely]] {
|
||||
warn_if_blocking(this->component_, blocking_time);
|
||||
warn_blocking(this->component_, blocking_time);
|
||||
}
|
||||
return curr_time;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user