mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	Shows component operation time in ms (#6388)
				
					
				
			Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
		| @@ -5,6 +5,7 @@ | |||||||
| #include "esphome/core/helpers.h" | #include "esphome/core/helpers.h" | ||||||
| #include "esphome/core/log.h" | #include "esphome/core/log.h" | ||||||
| #include <utility> | #include <utility> | ||||||
|  | #include <cinttypes> | ||||||
|  |  | ||||||
| namespace esphome { | namespace esphome { | ||||||
|  |  | ||||||
| @@ -211,8 +212,8 @@ WarnIfComponentBlockingGuard::~WarnIfComponentBlockingGuard() { | |||||||
|   uint32_t now = millis(); |   uint32_t now = millis(); | ||||||
|   if (now - started_ > 50) { |   if (now - started_ > 50) { | ||||||
|     const char *src = component_ == nullptr ? "<null>" : component_->get_component_source(); |     const char *src = component_ == nullptr ? "<null>" : component_->get_component_source(); | ||||||
|     ESP_LOGW(TAG, "Component %s took a long time for an operation (%.2f s).", src, (now - started_) / 1e3f); |     ESP_LOGW(TAG, "Component %s took a long time for an operation (%" PRIu32 " ms).", src, (now - started_)); | ||||||
|     ESP_LOGW(TAG, "Components should block for at most 20-30ms."); |     ESP_LOGW(TAG, "Components should block for at most 30 ms."); | ||||||
|     ; |     ; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user