counting per-channel traffic

This commit is contained in:
rusefillc 2023-03-16 13:14:25 -04:00
parent 3e14876e9e
commit 8ef2af44f3
3 changed files with 15 additions and 2 deletions

View File

@ -120,6 +120,10 @@ static void printTsStats(void) {
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
#if EFI_USB_SERIAL
printUsbConnectorStats();
#endif // EFI_USB_SERIAL
printErrorCounters(); printErrorCounters();
} }

View File

@ -9,5 +9,8 @@
#pragma once #pragma once
void initializeConsole(); void initializeConsole();
void startUsbConsole(); void startUsbConsole();
void printUsbConnectorStats();
void startEthernetConsole(); void startEthernetConsole();

View File

@ -24,11 +24,14 @@ public:
} }
void write(const uint8_t* buffer, size_t size, bool /*isEndOfPacket*/) override { void write(const uint8_t* buffer, size_t size, bool /*isEndOfPacket*/) override {
chnWriteTimeout(m_channel, buffer, size, BINARY_IO_TIMEOUT); size_t transferred = chnWriteTimeout(m_channel, buffer, size, BINARY_IO_TIMEOUT);
bytesOut += transferred;
} }
size_t readTimeout(uint8_t* buffer, size_t size, int timeout) override { size_t readTimeout(uint8_t* buffer, size_t size, int timeout) override {
return chnReadTimeout(m_channel, buffer, size, timeout); size_t transferred = chnReadTimeout(m_channel, buffer, size, timeout);
bytesIn += transferred;
return transferred;
} }
private: private:
@ -54,4 +57,7 @@ void startUsbConsole() {
usbConsole.start(); usbConsole.start();
} }
void printUsbConnectorStats() {
}
#endif // EFI_USB_SERIAL #endif // EFI_USB_SERIAL