More CPR stats.

This commit is contained in:
Oliver Jowett 2015-02-19 18:53:11 +00:00
parent 46ad97da15
commit f6d2f3dfff
6 changed files with 41 additions and 4 deletions

View file

@ -104,12 +104,16 @@ Each period has the following subkeys:
* reader: milliseconds spent reading sample data over USB from a SDR dongle * reader: milliseconds spent reading sample data over USB from a SDR dongle
* background: milliseconds spent doing network I/O, processing received network messages, and periodic tasks. * background: milliseconds spent doing network I/O, processing received network messages, and periodic tasks.
* cpr: statistics about Compact Position Report message decoding. Has subkeys: * cpr: statistics about Compact Position Report message decoding. Has subkeys:
* surface: total number of surface CPR messages received
* airborne: total number of airborne CPR messages received
* global_ok: global positions successfuly derived * global_ok: global positions successfuly derived
* global_bad: global positions that were rejected because they were inconsistent * global_bad: global positions that were rejected because they were inconsistent
* global_range: global positions that were rejected because they exceeded the receiver max range * global_range: global positions that were rejected because they exceeded the receiver max range
* global_speed: global positions that were rejected because they failed the inter-position speed check * global_speed: global positions that were rejected because they failed the inter-position speed check
* global_skipped: global position attempts skipped because we did not have the right data (e.g. even/odd messages crossed a zone boundary) * global_skipped: global position attempts skipped because we did not have the right data (e.g. even/odd messages crossed a zone boundary)
* local_ok: local (relative) positions successfully found * local_ok: local (relative) positions successfully found
* local_aircraft_relative: local positions found relative to a previous aircraft position
* local_receiver_relative: local positions found relative to the receiver position
* local_skipped: local (relative) positions not used because we did not have the right data * local_skipped: local (relative) positions not used because we did not have the right data
* local_range: local positions not used because they exceeded the receiver max range or fell into the ambiguous part of the receiver range * local_range: local positions not used because they exceeded the receiver max range or fell into the ambiguous part of the receiver range
* local_speed: local positions not used because they failed the inter-position speed check * local_speed: local positions not used because they failed the inter-position speed check

2
debian/changelog vendored
View file

@ -44,7 +44,7 @@ dump1090-mutability (1.14) UNRELEASED; urgency=medium
garbage). garbage).
* Fix stats timestamp output during the period shortly after restart. * Fix stats timestamp output during the period shortly after restart.
* Include timezone in timestamps shown with --stats * Include timezone in timestamps shown with --stats
* Add stats for CPR speed/range filtering. * Add various stats for CPR position-decoding details.
* Webmap: * Webmap:
* Fix webmap history loading when no history is present. * Fix webmap history loading when no history is present.

View file

@ -880,12 +880,16 @@ static char * appendStatsJson(char *p,
uint64_t background_cpu_millis = (uint64_t)st->background_cpu.tv_sec*1000UL + st->background_cpu.tv_nsec/1000000UL; uint64_t background_cpu_millis = (uint64_t)st->background_cpu.tv_sec*1000UL + st->background_cpu.tv_nsec/1000000UL;
p += snprintf(p, end-p, p += snprintf(p, end-p,
",\"cpr\":{\"global_ok\":%u" ",\"cpr\":{\"surface\":%u"
",\"airborne\":%u"
"\"global_ok\":%u"
",\"global_bad\":%u" ",\"global_bad\":%u"
",\"global_range\":%u" ",\"global_range\":%u"
",\"global_speed\":%u" ",\"global_speed\":%u"
",\"global_skipped\":%u" ",\"global_skipped\":%u"
",\"local_ok\":%u" ",\"local_ok\":%u"
",\"local_aircraft_relative\":%u"
",\"local_receiver_relative\":%u"
",\"local_skipped\":%u" ",\"local_skipped\":%u"
",\"local_range\":%u" ",\"local_range\":%u"
",\"local_speed\":%u" ",\"local_speed\":%u"
@ -894,12 +898,16 @@ static char * appendStatsJson(char *p,
",\"tracks\":{\"all\":%u" ",\"tracks\":{\"all\":%u"
",\"single_message\":%u}" ",\"single_message\":%u}"
",\"messages\":%u}", ",\"messages\":%u}",
st->cpr_surface,
st->cpr_airborne,
st->cpr_global_ok, st->cpr_global_ok,
st->cpr_global_bad, st->cpr_global_bad,
st->cpr_global_range_checks, st->cpr_global_range_checks,
st->cpr_global_speed_checks, st->cpr_global_speed_checks,
st->cpr_global_skipped, st->cpr_global_skipped,
st->cpr_local_ok, st->cpr_local_ok,
st->cpr_local_aircraft_relative,
st->cpr_local_receiver_relative,
st->cpr_local_skipped, st->cpr_local_skipped,
st->cpr_local_range_checks, st->cpr_local_range_checks,
st->cpr_local_speed_checks, st->cpr_local_speed_checks,

16
stats.c
View file

@ -122,22 +122,30 @@ void display_stats(struct stats *st) {
printf("%u total usable messages\n", printf("%u total usable messages\n",
st->messages_total); st->messages_total);
printf("%u global CPR attempts with valid positions\n" printf("%u surface position messages received\n"
"%u airborne position messages received\n"
"%u global CPR attempts with valid positions\n"
"%u global CPR attempts with bad data\n" "%u global CPR attempts with bad data\n"
" %u global CPR attempts that failed the range check\n" " %u global CPR attempts that failed the range check\n"
" %u global CPR attempts that failed the speed check\n" " %u global CPR attempts that failed the speed check\n"
"%u global CPR attempts with insufficient data\n" "%u global CPR attempts with insufficient data\n"
"%u local CPR attempts with valid positions\n" "%u local CPR attempts with valid positions\n"
"%u local CPR attempts with insufficient data\n" " %u aircraft-relative positions\n"
" %u receiver-relative positions\n"
"%u local CPR attempts that did not produce useful positions\n"
" %u local CPR attempts that failed the range check\n" " %u local CPR attempts that failed the range check\n"
" %u local CPR attempts that failed the speed check\n" " %u local CPR attempts that failed the speed check\n"
"%u CPR messages that look like transponder failures filtered\n", "%u CPR messages that look like transponder failures filtered\n",
st->cpr_surface,
st->cpr_airborne,
st->cpr_global_ok, st->cpr_global_ok,
st->cpr_global_bad, st->cpr_global_bad,
st->cpr_global_range_checks, st->cpr_global_range_checks,
st->cpr_global_speed_checks, st->cpr_global_speed_checks,
st->cpr_global_skipped, st->cpr_global_skipped,
st->cpr_local_ok, st->cpr_local_ok,
st->cpr_local_aircraft_relative,
st->cpr_local_receiver_relative,
st->cpr_local_skipped, st->cpr_local_skipped,
st->cpr_local_range_checks, st->cpr_local_range_checks,
st->cpr_local_speed_checks, st->cpr_local_speed_checks,
@ -233,12 +241,16 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t
target->http_requests = st1->http_requests + st2->http_requests; target->http_requests = st1->http_requests + st2->http_requests;
// CPR decoding: // CPR decoding:
target->cpr_surface = st1->cpr_surface + st2->cpr_surface;
target->cpr_airborne = st1->cpr_airborne + st2->cpr_airborne;
target->cpr_global_ok = st1->cpr_global_ok + st2->cpr_global_ok; target->cpr_global_ok = st1->cpr_global_ok + st2->cpr_global_ok;
target->cpr_global_bad = st1->cpr_global_bad + st2->cpr_global_bad; target->cpr_global_bad = st1->cpr_global_bad + st2->cpr_global_bad;
target->cpr_global_skipped = st1->cpr_global_skipped + st2->cpr_global_skipped; target->cpr_global_skipped = st1->cpr_global_skipped + st2->cpr_global_skipped;
target->cpr_global_range_checks = st1->cpr_global_range_checks + st2->cpr_global_range_checks; target->cpr_global_range_checks = st1->cpr_global_range_checks + st2->cpr_global_range_checks;
target->cpr_global_speed_checks = st1->cpr_global_speed_checks + st2->cpr_global_speed_checks; target->cpr_global_speed_checks = st1->cpr_global_speed_checks + st2->cpr_global_speed_checks;
target->cpr_local_ok = st1->cpr_local_ok + st2->cpr_local_ok; target->cpr_local_ok = st1->cpr_local_ok + st2->cpr_local_ok;
target->cpr_local_aircraft_relative = st1->cpr_local_aircraft_relative + st2->cpr_local_aircraft_relative;
target->cpr_local_receiver_relative = st1->cpr_local_receiver_relative + st2->cpr_local_receiver_relative;
target->cpr_local_skipped = st1->cpr_local_skipped + st2->cpr_local_skipped; target->cpr_local_skipped = st1->cpr_local_skipped + st2->cpr_local_skipped;
target->cpr_local_range_checks = st1->cpr_local_range_checks + st2->cpr_local_range_checks; target->cpr_local_range_checks = st1->cpr_local_range_checks + st2->cpr_local_range_checks;
target->cpr_local_speed_checks = st1->cpr_local_speed_checks + st2->cpr_local_speed_checks; target->cpr_local_speed_checks = st1->cpr_local_speed_checks + st2->cpr_local_speed_checks;

View file

@ -99,6 +99,8 @@ struct stats {
uint32_t http_requests; uint32_t http_requests;
// CPR decoding: // CPR decoding:
unsigned int cpr_surface;
unsigned int cpr_airborne;
unsigned int cpr_global_ok; unsigned int cpr_global_ok;
unsigned int cpr_global_bad; unsigned int cpr_global_bad;
unsigned int cpr_global_skipped; unsigned int cpr_global_skipped;
@ -108,6 +110,8 @@ struct stats {
unsigned int cpr_local_skipped; unsigned int cpr_local_skipped;
unsigned int cpr_local_range_checks; unsigned int cpr_local_range_checks;
unsigned int cpr_local_speed_checks; unsigned int cpr_local_speed_checks;
unsigned int cpr_local_aircraft_relative;
unsigned int cpr_local_receiver_relative;
unsigned int cpr_filtered; unsigned int cpr_filtered;
// aircraft: // aircraft:

View file

@ -326,6 +326,11 @@ static void updatePosition(struct aircraft *a, struct modesMessage *mm, uint64_t
double new_lat = 0, new_lon = 0; double new_lat = 0, new_lon = 0;
unsigned new_nuc = 0; unsigned new_nuc = 0;
if (mm->bFlags & MODES_ACFLAGS_AOG)
++Modes.stats_current.cpr_surface;
else
++Modes.stats_current.cpr_airborne;
if (mm->bFlags & MODES_ACFLAGS_AOG) { if (mm->bFlags & MODES_ACFLAGS_AOG) {
// Surface: 25 seconds if >25kt or speed unknown, 50 seconds otherwise // Surface: 25 seconds if >25kt or speed unknown, 50 seconds otherwise
@ -390,6 +395,10 @@ static void updatePosition(struct aircraft *a, struct modesMessage *mm, uint64_t
Modes.stats_current.cpr_local_skipped++; Modes.stats_current.cpr_local_skipped++;
} else { } else {
Modes.stats_current.cpr_local_ok++; Modes.stats_current.cpr_local_ok++;
if (a->bFlags & MODES_ACFLAGS_LATLON_REL_OK)
Modes.stats_current.cpr_local_aircraft_relative++;
else
Modes.stats_current.cpr_local_receiver_relative++;
mm->bFlags |= MODES_ACFLAGS_REL_CPR_USED; mm->bFlags |= MODES_ACFLAGS_REL_CPR_USED;
} }
} }