Merge branch 'more-stats'
This commit is contained in:
commit
b58ae5a17e
126
dump1090.c
126
dump1090.c
|
@ -436,6 +436,7 @@ void showHelp(void) {
|
||||||
"--aggressive More CPU for more messages (two bits fixes, ...)\n"
|
"--aggressive More CPU for more messages (two bits fixes, ...)\n"
|
||||||
"--mlat display raw messages in Beast ascii mode\n"
|
"--mlat display raw messages in Beast ascii mode\n"
|
||||||
"--stats With --ifile print stats at exit. No other output\n"
|
"--stats With --ifile print stats at exit. No other output\n"
|
||||||
|
"--stats-every <seconds> Show and reset stats every <seconds> seconds\n"
|
||||||
"--onlyaddr Show only ICAO addresses (testing purposes)\n"
|
"--onlyaddr Show only ICAO addresses (testing purposes)\n"
|
||||||
"--metric Use metric units (meters, km/h, ...)\n"
|
"--metric Use metric units (meters, km/h, ...)\n"
|
||||||
"--snip <level> Strip IQ file removing samples < level\n"
|
"--snip <level> Strip IQ file removing samples < level\n"
|
||||||
|
@ -489,6 +490,81 @@ void showCopyright(void) {
|
||||||
while (llTime >= time(NULL)) {}
|
while (llTime >= time(NULL)) {}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void display_stats(void) {
|
||||||
|
int j;
|
||||||
|
time_t now = time(NULL);
|
||||||
|
|
||||||
|
printf("\n\n");
|
||||||
|
if (Modes.interactive)
|
||||||
|
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);
|
||||||
|
printf("%d DF-?? fields corrected for length\n", Modes.stat_DF_Len_Corrected);
|
||||||
|
printf("%d DF-?? fields corrected for type\n", Modes.stat_DF_Type_Corrected);
|
||||||
|
printf("%d demodulated with 0 errors\n", Modes.stat_demodulated0);
|
||||||
|
printf("%d demodulated with 1 error\n", Modes.stat_demodulated1);
|
||||||
|
printf("%d demodulated with 2 errors\n", Modes.stat_demodulated2);
|
||||||
|
printf("%d demodulated with > 2 errors\n", Modes.stat_demodulated3);
|
||||||
|
printf("%d with good crc\n", Modes.stat_goodcrc);
|
||||||
|
printf("%d with bad crc\n", Modes.stat_badcrc);
|
||||||
|
printf("%d errors corrected\n", Modes.stat_fixed);
|
||||||
|
|
||||||
|
Modes.stat_ModeAC =
|
||||||
|
Modes.stat_valid_preamble =
|
||||||
|
Modes.stat_DF_Len_Corrected =
|
||||||
|
Modes.stat_DF_Type_Corrected =
|
||||||
|
Modes.stat_demodulated0 =
|
||||||
|
Modes.stat_demodulated1 =
|
||||||
|
Modes.stat_demodulated2 =
|
||||||
|
Modes.stat_demodulated3 =
|
||||||
|
Modes.stat_goodcrc =
|
||||||
|
Modes.stat_badcrc =
|
||||||
|
Modes.stat_fixed = 0;
|
||||||
|
|
||||||
|
for (j = 0; j < MODES_MAX_BITERRORS; j++) {
|
||||||
|
printf(" %d with %d bit %s\n", Modes.stat_bit_fix[j], j+1, (j==0)?"error":"errors");
|
||||||
|
Modes.stat_bit_fix[j] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Modes.phase_enhance) {
|
||||||
|
printf("%d phase enhancement attempts\n", Modes.stat_out_of_phase);
|
||||||
|
printf("%d phase enhanced demodulated with 0 errors\n", Modes.stat_ph_demodulated0);
|
||||||
|
printf("%d phase enhanced demodulated with 1 error\n", Modes.stat_ph_demodulated1);
|
||||||
|
printf("%d phase enhanced demodulated with 2 errors\n", Modes.stat_ph_demodulated2);
|
||||||
|
printf("%d phase enhanced demodulated with > 2 errors\n", Modes.stat_ph_demodulated3);
|
||||||
|
printf("%d phase enhanced with good crc\n", Modes.stat_ph_goodcrc);
|
||||||
|
printf("%d phase enhanced with bad crc\n", Modes.stat_ph_badcrc);
|
||||||
|
printf("%d phase enhanced errors corrected\n", Modes.stat_ph_fixed);
|
||||||
|
|
||||||
|
Modes.stat_out_of_phase =
|
||||||
|
Modes.stat_ph_demodulated0 =
|
||||||
|
Modes.stat_ph_demodulated1 =
|
||||||
|
Modes.stat_ph_demodulated2 =
|
||||||
|
Modes.stat_ph_demodulated3 =
|
||||||
|
Modes.stat_ph_goodcrc =
|
||||||
|
Modes.stat_ph_badcrc =
|
||||||
|
Modes.stat_ph_fixed = 0;
|
||||||
|
|
||||||
|
for (j = 0; j < MODES_MAX_BITERRORS; j++) {
|
||||||
|
printf(" %d with %d bit %s\n", Modes.stat_ph_bit_fix[j], j+1, (j==0)?"error":"errors");
|
||||||
|
Modes.stat_ph_bit_fix[j] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d total usable messages\n", Modes.stat_goodcrc + Modes.stat_ph_goodcrc + Modes.stat_fixed + Modes.stat_ph_fixed);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
//
|
//
|
||||||
|
@ -497,6 +573,8 @@ void showCopyright(void) {
|
||||||
// from the net, refreshing the screen in interactive mode, and so forth
|
// from the net, refreshing the screen in interactive mode, and so forth
|
||||||
//
|
//
|
||||||
void backgroundTasks(void) {
|
void backgroundTasks(void) {
|
||||||
|
static time_t next_stats;
|
||||||
|
|
||||||
if (Modes.net) {
|
if (Modes.net) {
|
||||||
modesReadFromClients();
|
modesReadFromClients();
|
||||||
}
|
}
|
||||||
|
@ -510,6 +588,15 @@ void backgroundTasks(void) {
|
||||||
if (Modes.interactive) {
|
if (Modes.interactive) {
|
||||||
interactiveShowData();
|
interactiveShowData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Modes.stats > 0) {
|
||||||
|
time_t now = time(NULL);
|
||||||
|
if (now > next_stats) {
|
||||||
|
if (next_stats != 0)
|
||||||
|
display_stats();
|
||||||
|
next_stats = now + Modes.stats;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
@ -674,7 +761,9 @@ int main(int argc, char **argv) {
|
||||||
f++;
|
f++;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(argv[j],"--stats")) {
|
} else if (!strcmp(argv[j],"--stats")) {
|
||||||
Modes.stats = 1;
|
Modes.stats = -1;
|
||||||
|
} else if (!strcmp(argv[j],"--stats-every") && more) {
|
||||||
|
Modes.stats = atoi(argv[++j]);
|
||||||
} else if (!strcmp(argv[j],"--snip") && more) {
|
} else if (!strcmp(argv[j],"--snip") && more) {
|
||||||
snipMode(atoi(argv[++j]));
|
snipMode(atoi(argv[++j]));
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -787,6 +876,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,7 +891,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);
|
||||||
|
@ -813,37 +903,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
// If --stats were given, print statistics
|
// If --stats were given, print statistics
|
||||||
if (Modes.stats) {
|
if (Modes.stats) {
|
||||||
printf("\n\n");
|
display_stats();
|
||||||
if (Modes.interactive)
|
|
||||||
interactiveShowData();
|
|
||||||
printf("%d ModeA/C detected\n", Modes.stat_ModeAC);
|
|
||||||
printf("%d valid Mode-S preambles\n", Modes.stat_valid_preamble);
|
|
||||||
printf("%d DF-?? fields corrected for length\n", Modes.stat_DF_Len_Corrected);
|
|
||||||
printf("%d DF-?? fields corrected for type\n", Modes.stat_DF_Type_Corrected);
|
|
||||||
printf("%d demodulated with 0 errors\n", Modes.stat_demodulated0);
|
|
||||||
printf("%d demodulated with 1 error\n", Modes.stat_demodulated1);
|
|
||||||
printf("%d demodulated with 2 errors\n", Modes.stat_demodulated2);
|
|
||||||
printf("%d demodulated with > 2 errors\n", Modes.stat_demodulated3);
|
|
||||||
printf("%d with good crc\n", Modes.stat_goodcrc);
|
|
||||||
printf("%d with bad crc\n", Modes.stat_badcrc);
|
|
||||||
printf("%d errors corrected\n", Modes.stat_fixed);
|
|
||||||
for (j = 0; j < MODES_MAX_BITERRORS; j++) {
|
|
||||||
printf(" %d with %d bit %s\n", Modes.stat_bit_fix[j], j+1, (j==0)?"error":"errors");
|
|
||||||
}
|
|
||||||
if (Modes.phase_enhance) {
|
|
||||||
printf("%d phase enhancement attempts\n", Modes.stat_out_of_phase);
|
|
||||||
printf("%d phase enhanced demodulated with 0 errors\n", Modes.stat_ph_demodulated0);
|
|
||||||
printf("%d phase enhanced demodulated with 1 error\n", Modes.stat_ph_demodulated1);
|
|
||||||
printf("%d phase enhanced demodulated with 2 errors\n", Modes.stat_ph_demodulated2);
|
|
||||||
printf("%d phase enhanced demodulated with > 2 errors\n", Modes.stat_ph_demodulated3);
|
|
||||||
printf("%d phase enhanced with good crc\n", Modes.stat_ph_goodcrc);
|
|
||||||
printf("%d phase enhanced with bad crc\n", Modes.stat_ph_badcrc);
|
|
||||||
printf("%d phase enhanced errors corrected\n", Modes.stat_ph_fixed);
|
|
||||||
for (j = 0; j < MODES_MAX_BITERRORS; j++) {
|
|
||||||
printf(" %d with %d bit %s\n", Modes.stat_ph_bit_fix[j], j+1, (j==0)?"error":"errors");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("%d total usable messages\n", Modes.stat_goodcrc + Modes.stat_ph_goodcrc + Modes.stat_fixed + Modes.stat_ph_fixed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Modes.filename == NULL) {
|
if (Modes.filename == NULL) {
|
||||||
|
|
|
@ -368,6 +368,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.
|
||||||
|
|
Loading…
Reference in a new issue