TS: stats: count specific error replies

This commit is contained in:
Andrey Gusakov 2024-06-17 13:15:32 +03:00 committed by rusefillc
parent 99fc15eadc
commit 9767493096
3 changed files with 35 additions and 1 deletions

View File

@ -96,6 +96,9 @@ static void printErrorCounters() {
tsState.outputChannelsCommandCounter, tsState.readPageCommandsCounter, tsState.burnCommandCounter); tsState.outputChannelsCommandCounter, tsState.readPageCommandsCounter, tsState.burnCommandCounter);
efiPrintf("TunerStudio W=%d / C=%d / P=%d", tsState.writeValueCommandCounter, efiPrintf("TunerStudio W=%d / C=%d / P=%d", tsState.writeValueCommandCounter,
tsState.writeChunkCommandCounter, tsState.pageCommandCounter); tsState.writeChunkCommandCounter, tsState.pageCommandCounter);
efiPrintf("TunerStudio errors: underrun=%d / overrun=%d / crc=%d / unrecognized=%d / outofrange=%d / other=%d",
tsState.errorUnderrunCounter, tsState.errorOverrunCounter, tsState.errorCrcCounter,
tsState.errorUnrecognizedCommand, tsState.errorOutOfRange, tsState.errorOther);
} }
static void printScatterList() { static void printScatterList() {
@ -161,6 +164,27 @@ void sendErrorCode(TsChannelBase *tsChannel, uint8_t code, const char *msg) {
// efiPrintf("TS <- Err: %d [%s]", code, msg); // efiPrintf("TS <- Err: %d [%s]", code, msg);
// } // }
switch (code) {
case TS_RESPONSE_UNDERRUN:
tsState.errorUnderrunCounter++;
break;
case TS_RESPONSE_OVERRUN:
tsState.errorOverrunCounter++;
break;
case TS_RESPONSE_CRC_FAILURE:
tsState.errorCrcCounter++;
break;
case TS_RESPONSE_UNRECOGNIZED_COMMAND:
tsState.errorUnrecognizedCommand++;
break;
case TS_RESPONSE_OUT_OF_RANGE:
tsState.errorOutOfRange++;
break;
default:
tsState.errorOther++;
break;
}
tsChannel->writeCrcResponse(code); tsChannel->writeCrcResponse(code);
} }

View File

@ -18,10 +18,19 @@ typedef struct {
int writeValueCommandCounter; int writeValueCommandCounter;
int crc32CheckCommandCounter; int crc32CheckCommandCounter;
int writeChunkCommandCounter; int writeChunkCommandCounter;
int errorCounter;
int totalCounter; int totalCounter;
int textCommandCounter; int textCommandCounter;
int testCommandCounter; int testCommandCounter;
// overall counter, not all of this errors are reported back to TS
int errorCounter;
// by type error counters reported to TS
int errorUnderrunCounter;
int errorOverrunCounter;
int errorCrcCounter;
int errorUnrecognizedCommand;
int errorOutOfRange;
int errorOther;
} tunerstudio_counters_s; } tunerstudio_counters_s;
extern tunerstudio_counters_s tsState; extern tunerstudio_counters_s tsState;

View File

@ -1567,6 +1567,7 @@
#define TS_RESPONSE_FRAMING_ERROR 0x8D #define TS_RESPONSE_FRAMING_ERROR 0x8D
#define TS_RESPONSE_OK 0 #define TS_RESPONSE_OK 0
#define TS_RESPONSE_OUT_OF_RANGE 0x84 #define TS_RESPONSE_OUT_OF_RANGE 0x84
#define TS_RESPONSE_OVERRUN 0x81
#define TS_RESPONSE_UNDERRUN 0x80 #define TS_RESPONSE_UNDERRUN 0x80
#define TS_RESPONSE_UNRECOGNIZED_COMMAND 0x83 #define TS_RESPONSE_UNRECOGNIZED_COMMAND 0x83
#define TS_SET_LOGGER_SWITCH 'l' #define TS_SET_LOGGER_SWITCH 'l'