Add stats for number of sample blocks processed and dropped.

This commit is contained in:
Oliver Jowett 2014-09-25 20:35:54 +01:00
parent 10061675de
commit 4fc2697555
2 changed files with 9 additions and 1 deletions

View file

@ -492,6 +492,10 @@ static void display_stats(void) {
interactiveShowData(); interactiveShowData();
printf("Statistics as at %s", ctime(&now)); printf("Statistics as at %s", ctime(&now));
printf("%d sample blocks processed\n", Modes.stat_blocks_processed);
printf("%d sample blocks dropped\n", Modes.stat_blocks_dropped);
Modes.stat_blocks_processed =
Modes.stat_blocks_dropped = 0;
printf("%d ModeA/C detected\n", Modes.stat_ModeAC); printf("%d ModeA/C detected\n", Modes.stat_ModeAC);
printf("%d valid Mode-S preambles\n", Modes.stat_valid_preamble); printf("%d valid Mode-S preambles\n", Modes.stat_valid_preamble);
@ -838,6 +842,7 @@ int main(int argc, char **argv) {
// If we lost some blocks, correct the timestamp // If we lost some blocks, correct the timestamp
if (Modes.iDataLost) { if (Modes.iDataLost) {
Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES * 6 * Modes.iDataLost); Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES * 6 * Modes.iDataLost);
Modes.stat_blocks_dropped += Modes.iDataLost;
Modes.iDataLost = 0; Modes.iDataLost = 0;
} }
@ -852,7 +857,7 @@ int main(int argc, char **argv) {
// Update the timestamp ready for the next block // Update the timestamp ready for the next block
Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES*6); Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES*6);
Modes.stat_blocks_processed++;
} else { } else {
pthread_cond_signal (&Modes.data_cond); pthread_cond_signal (&Modes.data_cond);
pthread_mutex_unlock(&Modes.data_mutex); pthread_mutex_unlock(&Modes.data_mutex);

View file

@ -366,6 +366,9 @@ struct { // Internal state
unsigned int stat_DF_Len_Corrected; unsigned int stat_DF_Len_Corrected;
unsigned int stat_DF_Type_Corrected; unsigned int stat_DF_Type_Corrected;
unsigned int stat_ModeAC; unsigned int stat_ModeAC;
unsigned int stat_blocks_processed;
unsigned int stat_blocks_dropped;
} Modes; } Modes;
// The struct we use to store information about a decoded message. // The struct we use to store information about a decoded message.