@@ -638,8 +638,38 @@ constexpr uint32_t LOG_ITEM_INTERVAL_MS = RUN::TASK_INTERVALS::TI_LOG_DATA_ms;
638638 // delay(LOG_ITEM_INTERVAL_MS);
639639
640640 ESP_LOGI (TAG , " %s" , INA260::getLogString ().c_str ());
641-
642- ESP_LOGI (TAG , " %s" , loadComms.getLogString ().c_str ());
641+
642+ static unsigned int prevTime_us = 0 ;
643+ static LoadComms::LogData lastLogData = {0 };
644+ unsigned int currentTime_us = micros ();
645+ ESP_LOGI (TAG , " %s" , loadComms.getLogString ().c_str ());
646+ LoadComms::LogData currentLogData = loadComms.getLogData ();
647+ unsigned long deltaTime_us = currentTime_us - prevTime_us;
648+ uint_fast32_t deltaTxEvents =
649+ currentLogData.txEvents - lastLogData.txEvents ;
650+ uint_fast32_t deltaBytesSent =
651+ currentLogData.bytesSent - lastLogData.bytesSent ;
652+ uint_fast32_t deltaBytesFailed =
653+ currentLogData.bytesNotSent - lastLogData.bytesNotSent ;
654+ uint_fast32_t deltaRxEvents =
655+ currentLogData.rxEvents - lastLogData.rxEvents ;
656+ uint_fast32_t deltaBytesReceived =
657+ currentLogData.bytesReceived - lastLogData.bytesReceived ;
658+
659+ constexpr unsigned long m_TO_BASE = 1000 ;
660+ constexpr unsigned long u_TO_m = 1000 ;
661+ constexpr unsigned long u_TO_BASE = m_TO_BASE * u_TO_m;
662+ ESP_LOGI (TAG , " TxE/s: %u, TxBS/s: %u, TxBF/s: %u, RxE/s: %u, RxB/s: %u" ,
663+ deltaTxEvents * u_TO_BASE / deltaTime_us,
664+ deltaBytesSent * u_TO_BASE / deltaTime_us,
665+ deltaBytesFailed * u_TO_BASE / deltaTime_us,
666+ deltaRxEvents * u_TO_BASE / deltaTime_us,
667+ deltaBytesReceived * u_TO_BASE / deltaTime_us);
668+ prevTime_us = currentTime_us;
669+ lastLogData = currentLogData;
670+
671+ unsigned int elapsedTime_us = currentTime_us - prevTime_us;
672+ prevTime_us = currentTime_us;
643673
644674 delay (LOG_ITEM_INTERVAL_MS );
645675
0 commit comments