From 4fc26975556b771d36abf5667751a9ba56e5a092 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Thu, 25 Sep 2014 20:35:54 +0100 Subject: [PATCH] Add stats for number of sample blocks processed and dropped. --- dump1090.c | 7 ++++++- dump1090.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dump1090.c b/dump1090.c index c129fd4..00f21d8 100644 --- a/dump1090.c +++ b/dump1090.c @@ -492,6 +492,10 @@ static void display_stats(void) { interactiveShowData(); 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 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 (Modes.iDataLost) { Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES * 6 * Modes.iDataLost); + Modes.stat_blocks_dropped += Modes.iDataLost; Modes.iDataLost = 0; } @@ -852,7 +857,7 @@ int main(int argc, char **argv) { // Update the timestamp ready for the next block Modes.timestampBlk += (MODES_ASYNC_BUF_SAMPLES*6); - + Modes.stat_blocks_processed++; } else { pthread_cond_signal (&Modes.data_cond); pthread_mutex_unlock(&Modes.data_mutex); diff --git a/dump1090.h b/dump1090.h index 77584bb..1339382 100644 --- a/dump1090.h +++ b/dump1090.h @@ -366,6 +366,9 @@ struct { // Internal state unsigned int stat_DF_Len_Corrected; unsigned int stat_DF_Type_Corrected; unsigned int stat_ModeAC; + + unsigned int stat_blocks_processed; + unsigned int stat_blocks_dropped; } Modes; // The struct we use to store information about a decoded message.