Skip to content

Commit

Permalink
Add accepted messages statistic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mictronics committed Feb 12, 2020
1 parent fbb2cb5 commit 2db3329
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 16 deletions.
11 changes: 11 additions & 0 deletions net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,7 @@ struct char_buffer generateStatsJson() {
}

static void createStatisticEntry(StatisticEntry *e, struct stats *st) {
int i;
e->start = st->start / 1000.0;
e->has_start = true;
e->stop = st->end / 1000.0;
Expand Down Expand Up @@ -2435,6 +2436,11 @@ static void createStatisticEntry(StatisticEntry *e, struct stats *st) {
}
e->local_strong_signals = st->strong_signal_count;
e->has_local_strong_signals = true;

for (i = 0; i <= Modes.nfix_crc; ++i) {
e->local_accepted += st->demod_accepted[i];
e->has_local_accepted = true;
}
}

if (Modes.net) {
Expand All @@ -2446,6 +2452,11 @@ static void createStatisticEntry(StatisticEntry *e, struct stats *st) {
e->has_remote_bad = true;
e->remote_unknown_icao = st->remote_rejected_unknown_icao;
e->has_remote_unknown_icao = true;

for (i = 0; i <= Modes.nfix_crc; ++i) {
e->remote_accepted += st->remote_accepted[i];
e->has_remote_accepted = true;
}
}

e->cpr_surface = st->cpr_surface;
Expand Down
54 changes: 40 additions & 14 deletions readsb.pb-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ const ProtobufCMessageDescriptor receiver__descriptor =
(ProtobufCMessageInit) receiver__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor statistic_entry__field_descriptors[42] =
static const ProtobufCFieldDescriptor statistic_entry__field_descriptors[44] =
{
{
"start",
Expand Down Expand Up @@ -2088,6 +2088,18 @@ static const ProtobufCFieldDescriptor statistic_entry__field_descriptors[42] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"remote_accepted",
74,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_UINT64,
offsetof(StatisticEntry, has_remote_accepted),
offsetof(StatisticEntry, remote_accepted),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"local_samples_processed",
90,
Expand Down Expand Up @@ -2208,6 +2220,18 @@ static const ProtobufCFieldDescriptor statistic_entry__field_descriptors[42] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"local_accepted",
100,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_UINT64,
offsetof(StatisticEntry, has_local_accepted),
offsetof(StatisticEntry, local_accepted),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned statistic_entry__field_indices_by_name[] = {
5, /* field[5] = altitude_suppressed */
Expand All @@ -2228,19 +2252,21 @@ static const unsigned statistic_entry__field_indices_by_name[] = {
13, /* field[13] = cpu_background */
11, /* field[11] = cpu_demod */
12, /* field[12] = cpu_reader */
36, /* field[36] = local_bad */
34, /* field[34] = local_modeac */
35, /* field[35] = local_modes */
40, /* field[40] = local_noise */
41, /* field[41] = local_peak_signal */
33, /* field[33] = local_samples_dropped */
32, /* field[32] = local_samples_processed */
39, /* field[39] = local_signal */
38, /* field[38] = local_strong_signals */
37, /* field[37] = local_unknown_icao */
43, /* field[43] = local_accepted */
37, /* field[37] = local_bad */
35, /* field[35] = local_modeac */
36, /* field[36] = local_modes */
41, /* field[41] = local_noise */
42, /* field[42] = local_peak_signal */
34, /* field[34] = local_samples_dropped */
33, /* field[33] = local_samples_processed */
40, /* field[40] = local_signal */
39, /* field[39] = local_strong_signals */
38, /* field[38] = local_unknown_icao */
3, /* field[3] = max_distance_in_metres */
4, /* field[4] = max_distance_in_nautical_miles */
2, /* field[2] = messages */
32, /* field[32] = remote_accepted */
30, /* field[30] = remote_bad */
28, /* field[28] = remote_modeac */
29, /* field[29] = remote_modes */
Expand All @@ -2259,8 +2285,8 @@ static const ProtobufCIntRange statistic_entry__number_ranges[5 + 1] =
{ 20, 11 },
{ 40, 14 },
{ 70, 28 },
{ 90, 32 },
{ 0, 42 }
{ 90, 33 },
{ 0, 44 }
};
const ProtobufCMessageDescriptor statistic_entry__descriptor =
{
Expand All @@ -2270,7 +2296,7 @@ const ProtobufCMessageDescriptor statistic_entry__descriptor =
"StatisticEntry",
"",
sizeof(StatisticEntry),
42,
44,
statistic_entry__field_descriptors,
statistic_entry__field_indices_by_name,
5, statistic_entry__number_ranges,
Expand Down
6 changes: 5 additions & 1 deletion readsb.pb-c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions readsb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ message StatisticEntry {
uint64 remote_modes = 71;
uint64 remote_bad = 72;
uint64 remote_unknown_icao = 73;
uint64 remote_accepted = 74;
uint64 local_samples_processed = 90;
uint64 local_samples_dropped = 91;
uint64 local_modeac = 92;
Expand All @@ -233,6 +234,7 @@ message StatisticEntry {
float local_signal = 97;
float local_noise = 98;
float local_peak_signal = 99;
uint64 local_accepted = 100;
}

/**
Expand Down
14 changes: 14 additions & 0 deletions webapp/src/script/readsb/backend/readsb-pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/src/script/readsb/backend/readsb-pb.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions webapp/src/script/readsb/backend/readsb-pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,12 @@ namespace READSB {
cpr_local_range: 0,
cpr_local_speed: 0,
cpr_filtered: 0,
remote_accepted: 0,
remote_modeac: 0,
remote_modes: 0,
remote_bad: 0,
remote_unknown_icao: 0,
local_accepted: 0,
local_samples_processed: 0,
local_samples_dropped: 0,
local_modeac: 0,
Expand Down Expand Up @@ -432,6 +434,7 @@ namespace READSB {
else if (tag === 71) { obj.remote_modes = pbf.readVarint(); }
else if (tag === 72) { obj.remote_bad = pbf.readVarint(); }
else if (tag === 73) { obj.remote_unknown_icao = pbf.readVarint(); }
else if (tag === 74) { obj.remote_accepted = pbf.readVarint(); }
else if (tag === 90) { obj.local_samples_processed = pbf.readVarint(); }
else if (tag === 91) { obj.local_samples_dropped = pbf.readVarint(); }
else if (tag === 92) { obj.local_modeac = pbf.readVarint(); }
Expand All @@ -442,6 +445,7 @@ namespace READSB {
else if (tag === 97) { obj.local_signal = pbf.readFloat(); }
else if (tag === 98) { obj.local_noise = pbf.readFloat(); }
else if (tag === 99) { obj.local_peak_signal = pbf.readFloat(); }
else if (tag === 100) { obj.local_accepted = pbf.readVarint(); }
},
write(obj: IStatisticEntry, pbf: Pbf) {
if (obj.start) { pbf.writeVarintField(1, obj.start); }
Expand Down Expand Up @@ -473,6 +477,7 @@ namespace READSB {
if (obj.remote_modes) { pbf.writeVarintField(71, obj.remote_modes); }
if (obj.remote_bad) { pbf.writeVarintField(72, obj.remote_bad); }
if (obj.remote_unknown_icao) { pbf.writeVarintField(73, obj.remote_unknown_icao); }
if (obj.remote_accepted) { pbf.writeVarintField(74, obj.remote_accepted); }
if (obj.local_samples_processed) { pbf.writeVarintField(90, obj.local_samples_processed); }
if (obj.local_samples_dropped) { pbf.writeVarintField(91, obj.local_samples_dropped); }
if (obj.local_modeac) { pbf.writeVarintField(92, obj.local_modeac); }
Expand All @@ -483,6 +488,7 @@ namespace READSB {
if (obj.local_signal) { pbf.writeFloatField(97, obj.local_signal); }
if (obj.local_noise) { pbf.writeFloatField(98, obj.local_noise); }
if (obj.local_peak_signal) { pbf.writeFloatField(99, obj.local_peak_signal); }
if (obj.local_accepted) { pbf.writeVarintField(100, obj.local_accepted); }
},
};

Expand Down
2 changes: 2 additions & 0 deletions webapp/typings/readsb-pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ declare namespace READSB {
cpu_background?: number;
cpu_demod?: number;
cpu_reader?: number;
local_accepted?: number;
local_bad?: number;
local_modeac?: number;
local_modes?: number;
Expand All @@ -155,6 +156,7 @@ declare namespace READSB {
max_distance_in_metres?: number;
max_distance_in_nautical_miles?: number;
messages?: number;
remote_accepted?: number;
remote_bad?: number;
remote_modeac?: number;
remote_modes?: number;
Expand Down

0 comments on commit 2db3329

Please sign in to comment.