Add stats for total aircraft tracks and tracks that have only a single message.
This commit is contained in:
parent
f1201a0069
commit
a49b5b8830
|
@ -109,4 +109,9 @@ Each period has the following subkeys:
|
|||
* local_ok: local (relative) positions successfully found
|
||||
* local_skipped: local (relative) positions not used because we did not have the right data (e.g. position was ambiguous given the receiver range)
|
||||
* filtered: number of CPR messages ignored because they matched one of the heuristics for faulty transponder output
|
||||
* tracks: statistics on aircraft tracks. Each track represents a unique aircraft and persists for up to 5 minutes after the last message
|
||||
from the aircraft is heard. If messages from the same aircraft are subsequently heard after the 5 minute period, this will be counted
|
||||
as a new track.
|
||||
* all: total tracks created
|
||||
* single_message: tracks consisting of only a single message. These are usually due to message decoding errors that produce a bad aircraft address.
|
||||
* messages: total number of messages accepted by dump1090 from any source
|
||||
|
|
4
net_io.c
4
net_io.c
|
@ -887,6 +887,8 @@ static char * appendStatsJson(char *p,
|
|||
",\"local_skipped\":%u"
|
||||
",\"filtered\":%u}"
|
||||
",\"cpu\":{\"demod\":%llu,\"reader\":%llu,\"background\":%llu}"
|
||||
",\"tracks\":{\"all\":%u"
|
||||
",\"single_message\":%u}"
|
||||
",\"messages\":%u}",
|
||||
st->cpr_global_ok,
|
||||
st->cpr_global_bad,
|
||||
|
@ -897,6 +899,8 @@ static char * appendStatsJson(char *p,
|
|||
(unsigned long long)demod_cpu_millis,
|
||||
(unsigned long long)reader_cpu_millis,
|
||||
(unsigned long long)background_cpu_millis,
|
||||
st->unique_aircraft,
|
||||
st->single_message_aircraft,
|
||||
st->messages_total);
|
||||
}
|
||||
|
||||
|
|
8
stats.c
8
stats.c
|
@ -132,6 +132,9 @@ void display_stats(struct stats *st) {
|
|||
st->cpr_local_skipped,
|
||||
st->cpr_filtered);
|
||||
|
||||
printf("%u unique aircraft tracks\n", st->unique_aircraft);
|
||||
printf("%u aircraft tracks where only one message was seen\n", st->single_message_aircraft);
|
||||
|
||||
if (Modes.net && Modes.net_http_port)
|
||||
printf("%d HTTP requests\n", st->http_requests);
|
||||
|
||||
|
@ -150,6 +153,7 @@ void display_stats(struct stats *st) {
|
|||
(unsigned long long) background_cpu_millis);
|
||||
}
|
||||
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
@ -224,5 +228,9 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t
|
|||
target->cpr_local_ok = st1->cpr_local_ok + st2->cpr_local_ok;
|
||||
target->cpr_local_skipped = st1->cpr_local_skipped + st2->cpr_local_skipped;
|
||||
target->cpr_filtered = st1->cpr_filtered + st2->cpr_filtered;
|
||||
|
||||
// aircraft
|
||||
target->unique_aircraft = st1->unique_aircraft + st2->unique_aircraft;
|
||||
target->single_message_aircraft = st1->single_message_aircraft + st2->single_message_aircraft;
|
||||
}
|
||||
|
||||
|
|
6
stats.h
6
stats.h
|
@ -105,6 +105,12 @@ struct stats {
|
|||
unsigned int cpr_local_ok;
|
||||
unsigned int cpr_local_skipped;
|
||||
unsigned int cpr_filtered;
|
||||
|
||||
// aircraft:
|
||||
// total "new" aircraft (i.e. not seen in the last 30 or 300s)
|
||||
unsigned int unique_aircraft;
|
||||
// we saw only a single message
|
||||
unsigned int single_message_aircraft;
|
||||
};
|
||||
|
||||
void add_stats(const struct stats *st1, const struct stats *st2, struct stats *target);
|
||||
|
|
7
track.c
7
track.c
|
@ -84,6 +84,8 @@ struct aircraft *trackCreateAircraft(struct modesMessage *mm) {
|
|||
// Copy the first message so we can emit it later when a second message arrives.
|
||||
a->first_message = *mm;
|
||||
|
||||
Modes.stats_current.unique_aircraft++;
|
||||
|
||||
return (a);
|
||||
}
|
||||
|
||||
|
@ -490,6 +492,11 @@ static void trackRemoveStaleAircraft(time_t now)
|
|||
while(a) {
|
||||
if ((now - a->seen) > TRACK_AIRCRAFT_TTL ||
|
||||
(a->messages == 1 && (now - a->seen) > TRACK_AIRCRAFT_ONEHIT_TTL)) {
|
||||
// Count aircraft where we saw only one message before reaping them.
|
||||
// These are likely to be due to messages with bad addresses.
|
||||
if (a->messages == 1)
|
||||
Modes.stats_current.single_message_aircraft++;
|
||||
|
||||
// Remove the element from the linked list, with care
|
||||
// if we are removing the first element
|
||||
if (!prev) {
|
||||
|
|
Loading…
Reference in a new issue