Collect stats on messages received by DF type
This commit is contained in:
parent
11fb727325
commit
6a11387861
3
mode_s.c
3
mode_s.c
|
|
@ -2142,6 +2142,9 @@ void useModesMessage(struct modesMessage *mm) {
|
||||||
struct aircraft *a;
|
struct aircraft *a;
|
||||||
|
|
||||||
++Modes.stats_current.messages_total;
|
++Modes.stats_current.messages_total;
|
||||||
|
if (mm->msgtype >= 0 && mm->msgtype < 32) {
|
||||||
|
++Modes.stats_current.messages_by_df[mm->msgtype];
|
||||||
|
}
|
||||||
|
|
||||||
// Track aircraft state
|
// Track aircraft state
|
||||||
a = trackUpdateFromMessage(mm);
|
a = trackUpdateFromMessage(mm);
|
||||||
|
|
|
||||||
10
net_io.c
10
net_io.c
|
|
@ -1791,7 +1791,7 @@ static char * appendStatsJson(char *p,
|
||||||
",\"tracks\":{\"all\":%u"
|
",\"tracks\":{\"all\":%u"
|
||||||
",\"single_message\":%u"
|
",\"single_message\":%u"
|
||||||
",\"unreliable\":%u}"
|
",\"unreliable\":%u}"
|
||||||
",\"messages\":%u}",
|
",\"messages\":%u",
|
||||||
st->cpr_surface,
|
st->cpr_surface,
|
||||||
st->cpr_airborne,
|
st->cpr_airborne,
|
||||||
st->cpr_global_ok,
|
st->cpr_global_ok,
|
||||||
|
|
@ -1814,6 +1814,14 @@ static char * appendStatsJson(char *p,
|
||||||
st->single_message_aircraft,
|
st->single_message_aircraft,
|
||||||
st->unreliable_aircraft,
|
st->unreliable_aircraft,
|
||||||
st->messages_total);
|
st->messages_total);
|
||||||
|
|
||||||
|
for (i = 0; i < 32; ++i) {
|
||||||
|
if (i == 0)
|
||||||
|
p = safe_snprintf(p, end, ",\"messages_by_df\":[%u", st->messages_by_df[i]);
|
||||||
|
else
|
||||||
|
p = safe_snprintf(p, end, ",%u", st->messages_by_df[i]);
|
||||||
|
}
|
||||||
|
p = safe_snprintf(p, end, "]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
|
||||||
9
stats.c
9
stats.c
|
|
@ -125,9 +125,14 @@ void display_stats(struct stats *st) {
|
||||||
printf(" %8u accepted with %d-bit error repaired\n", st->remote_accepted[j], j);
|
printf(" %8u accepted with %d-bit error repaired\n", st->remote_accepted[j], j);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%u total usable messages\n",
|
printf("%8u total usable messages\n",
|
||||||
st->messages_total);
|
st->messages_total);
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < 32; ++i) {
|
||||||
|
if (st->messages_by_df[i])
|
||||||
|
printf(" %8u DF%u messages\n", st->messages_by_df[i], i);
|
||||||
|
}
|
||||||
|
|
||||||
printf("%8u surface position messages received\n"
|
printf("%8u surface position messages received\n"
|
||||||
"%8u airborne position messages received\n"
|
"%8u airborne position messages received\n"
|
||||||
"%8u global CPR attempts with valid positions\n"
|
"%8u global CPR attempts with valid positions\n"
|
||||||
|
|
@ -310,6 +315,8 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t
|
||||||
|
|
||||||
// total messages:
|
// total messages:
|
||||||
target->messages_total = st1->messages_total + st2->messages_total;
|
target->messages_total = st1->messages_total + st2->messages_total;
|
||||||
|
for (i = 0; i < 32; ++i)
|
||||||
|
target->messages_by_df[i] = st1->messages_by_df[i] + st2->messages_by_df[i];
|
||||||
|
|
||||||
// CPR decoding:
|
// CPR decoding:
|
||||||
target->cpr_surface = st1->cpr_surface + st2->cpr_surface;
|
target->cpr_surface = st1->cpr_surface + st2->cpr_surface;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue