From b2e91536537b7c030a24e5539119633a8a7aa184 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Wed, 27 Nov 2019 21:41:33 +0800 Subject: [PATCH] Add stats for unreliable tracks --- net_io.c | 2 ++ stats.c | 2 ++ stats.h | 2 ++ track.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/net_io.c b/net_io.c index a55f0cf..b5f1db8 100644 --- a/net_io.c +++ b/net_io.c @@ -1573,6 +1573,7 @@ static char * appendStatsJson(char *p, ",\"cpu\":{\"demod\":%llu,\"reader\":%llu,\"background\":%llu}" ",\"tracks\":{\"all\":%u" ",\"single_message\":%u}" + ",\"unreliable_tracks\":%u}" ",\"messages\":%u}", st->cpr_surface, st->cpr_airborne, @@ -1594,6 +1595,7 @@ static char * appendStatsJson(char *p, (unsigned long long)background_cpu_millis, st->unique_aircraft, st->single_message_aircraft, + st->unreliable_aircraft, st->messages_total); } diff --git a/stats.c b/stats.c index 62522f7..c031b5d 100644 --- a/stats.c +++ b/stats.c @@ -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 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 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; @@ -325,6 +326,7 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t // aircraft target->unique_aircraft = st1->unique_aircraft + st2->unique_aircraft; target->single_message_aircraft = st1->single_message_aircraft + st2->single_message_aircraft; + target->unreliable_aircraft = st1->unreliable_aircraft + st2->unreliable_aircraft; // range histogram for (i = 0; i < RANGE_BUCKET_COUNT; ++i) diff --git a/stats.h b/stats.h index 36ab59e..bd06bb0 100644 --- a/stats.h +++ b/stats.h @@ -120,6 +120,8 @@ struct stats { unsigned int unique_aircraft; // we saw only a single message unsigned int single_message_aircraft; + // we never considered the track reliable + unsigned int unreliable_aircraft; // range histogram #define RANGE_BUCKET_COUNT 76 diff --git a/track.c b/track.c index fde43ea..a42fc76 100644 --- a/track.c +++ b/track.c @@ -1307,6 +1307,8 @@ static void trackRemoveStaleAircraft(uint64_t now) // These are likely to be due to messages with bad addresses. if (a->messages == 1) Modes.stats_current.single_message_aircraft++; + if (!a->reliable) + Modes.stats_current.unreliable_aircraft++; // Remove the element from the linked list, with care // if we are removing the first element