Add stats for unreliable tracks

This commit is contained in:
Oliver Jowett 2019-11-27 21:41:33 +08:00
parent a8737f7916
commit b2e9153653
4 changed files with 8 additions and 0 deletions

View File

@ -1573,6 +1573,7 @@ static char * appendStatsJson(char *p,
",\"cpu\":{\"demod\":%llu,\"reader\":%llu,\"background\":%llu}" ",\"cpu\":{\"demod\":%llu,\"reader\":%llu,\"background\":%llu}"
",\"tracks\":{\"all\":%u" ",\"tracks\":{\"all\":%u"
",\"single_message\":%u}" ",\"single_message\":%u}"
",\"unreliable_tracks\":%u}"
",\"messages\":%u}", ",\"messages\":%u}",
st->cpr_surface, st->cpr_surface,
st->cpr_airborne, st->cpr_airborne,
@ -1594,6 +1595,7 @@ static char * appendStatsJson(char *p,
(unsigned long long)background_cpu_millis, (unsigned long long)background_cpu_millis,
st->unique_aircraft, st->unique_aircraft,
st->single_message_aircraft, st->single_message_aircraft,
st->unreliable_aircraft,
st->messages_total); st->messages_total);
} }

View File

@ -154,6 +154,7 @@ void display_stats(struct stats *st) {
printf("%u non-ES altitude messages from ES-equipped aircraft ignored\n", st->suppressed_altitude_messages); printf("%u non-ES altitude messages from ES-equipped aircraft ignored\n", st->suppressed_altitude_messages);
printf("%u unique aircraft tracks\n", st->unique_aircraft); printf("%u unique aircraft tracks\n", st->unique_aircraft);
printf("%u aircraft tracks where only one message was seen\n", st->single_message_aircraft); printf("%u aircraft tracks where only one message was seen\n", st->single_message_aircraft);
printf("%u aircraft tracks which were not marked reliable\n", st->unreliable_aircraft);
{ {
uint64_t demod_cpu_millis = (uint64_t)st->demod_cpu.tv_sec*1000UL + st->demod_cpu.tv_nsec/1000000UL; uint64_t demod_cpu_millis = (uint64_t)st->demod_cpu.tv_sec*1000UL + st->demod_cpu.tv_nsec/1000000UL;
@ -325,6 +326,7 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t
// aircraft // aircraft
target->unique_aircraft = st1->unique_aircraft + st2->unique_aircraft; target->unique_aircraft = st1->unique_aircraft + st2->unique_aircraft;
target->single_message_aircraft = st1->single_message_aircraft + st2->single_message_aircraft; target->single_message_aircraft = st1->single_message_aircraft + st2->single_message_aircraft;
target->unreliable_aircraft = st1->unreliable_aircraft + st2->unreliable_aircraft;
// range histogram // range histogram
for (i = 0; i < RANGE_BUCKET_COUNT; ++i) for (i = 0; i < RANGE_BUCKET_COUNT; ++i)

View File

@ -120,6 +120,8 @@ struct stats {
unsigned int unique_aircraft; unsigned int unique_aircraft;
// we saw only a single message // we saw only a single message
unsigned int single_message_aircraft; unsigned int single_message_aircraft;
// we never considered the track reliable
unsigned int unreliable_aircraft;
// range histogram // range histogram
#define RANGE_BUCKET_COUNT 76 #define RANGE_BUCKET_COUNT 76

View File

@ -1307,6 +1307,8 @@ static void trackRemoveStaleAircraft(uint64_t now)
// These are likely to be due to messages with bad addresses. // These are likely to be due to messages with bad addresses.
if (a->messages == 1) if (a->messages == 1)
Modes.stats_current.single_message_aircraft++; Modes.stats_current.single_message_aircraft++;
if (!a->reliable)
Modes.stats_current.unreliable_aircraft++;
// Remove the element from the linked list, with care // Remove the element from the linked list, with care
// if we are removing the first element // if we are removing the first element