mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +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/log.h" | ||||
| #include <utility> | ||||
| #include <cinttypes> | ||||
|  | ||||
| namespace esphome { | ||||
|  | ||||
| @@ -211,8 +212,8 @@ WarnIfComponentBlockingGuard::~WarnIfComponentBlockingGuard() { | ||||
|   uint32_t now = millis(); | ||||
|   if (now - started_ > 50) { | ||||
|     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, "Components should block for at most 20-30ms."); | ||||
|     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 30 ms."); | ||||
|     ; | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user