diff options
author | Luke Berndt <lukekb@gmail.com> | 2023-04-05 20:12:40 -0400 |
---|---|---|
committer | Luke Berndt <lukekb@gmail.com> | 2023-04-05 20:12:40 -0400 |
commit | 592113f509750e71cbe4b0d290a7525cecfc5016 (patch) | |
tree | b2e507fac1c6a64e85fbdb5edd9083c5c9bde39f | |
parent | 9d9def8ce7afbbd324a36ccd7cb746f7d749d73d (diff) |
Adds the system rate to the Status print outs
-rw-r--r-- | trunk-recorder/main.cc | 31 | ||||
-rw-r--r-- | trunk-recorder/systems/system.h | 2 | ||||
-rw-r--r-- | trunk-recorder/systems/system_impl.cc | 10 | ||||
-rw-r--r-- | trunk-recorder/systems/system_impl.h | 3 |
4 files changed, 36 insertions, 10 deletions
diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index 9e3447dd..7584cb81 100644 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -36,6 +36,7 @@ #include <time.h> #include <unistd.h> #include <utility> +#include <cmath> #include "./global_structs.h" #include "recorder_globals.h" @@ -837,6 +838,15 @@ void print_status() { Source *source = *it; source->print_recorders(); } + + BOOST_LOG_TRIVIAL(info) << "Control Channel Decode Rates: "; + for (std::vector<System *>::iterator it = systems.begin(); it != systems.end(); ++it) { + System_impl *sys = (System_impl *)*it; + + if ((sys->get_system_type() != "conventional") && (sys->get_system_type() != "conventionalP25") && (sys->get_system_type() != "conventionalDMR")) { + BOOST_LOG_TRIVIAL(info) << "[" << sys->get_short_name() << "] " << sys->get_decode_rate() << " msg/sec"; + } + } } void manage_calls() { @@ -1380,7 +1390,8 @@ void check_message_count(float timeDiff) { System_impl *sys = (System_impl *)*it; if ((sys->get_system_type() != "conventional") && (sys->get_system_type() != "conventionalP25") && (sys->get_system_type() != "conventionalDMR")) { - float msgs_decoded_per_second = sys->message_count / timeDiff; + int msgs_decoded_per_second = std::floor(sys->message_count / timeDiff); + sys->set_decode_rate(msgs_decoded_per_second); if (msgs_decoded_per_second < 2) { @@ -1418,8 +1429,8 @@ void monitor_messages() { int sys_num; System *sys; - time_t lastStatusTime = time(NULL); - time_t lastMsgCountTime = time(NULL); + time_t last_status_time = time(NULL); + time_t last_decode_rate_check = time(NULL); time_t management_timestamp = time(NULL); time_t current_time = time(NULL); std::vector<TrunkMessage> trunk_messages; @@ -1491,11 +1502,11 @@ void monitor_messages() { current_time = time(NULL); - float timeDiff = current_time - lastMsgCountTime; + float decode_rate_check_time_diff = current_time - last_decode_rate_check; - if (timeDiff >= 3.0) { - check_message_count(timeDiff); - lastMsgCountTime = current_time; + if (decode_rate_check_time_diff >= 3.0) { + check_message_count(decode_rate_check_time_diff); + last_decode_rate_check = current_time; for (vector<System *>::iterator sys_it = systems.begin(); sys_it != systems.end(); sys_it++) { System *system = *sys_it; if (system->get_system_type() == "p25") { @@ -1504,10 +1515,10 @@ void monitor_messages() { } } - float statusTimeDiff = current_time - lastStatusTime; + float print_status_time_diff = current_time - last_status_time; - if (statusTimeDiff > 200) { - lastStatusTime = current_time; + if (print_status_time_diff > 200) { + last_status_time = current_time; print_status(); } } diff --git a/trunk-recorder/systems/system.h b/trunk-recorder/systems/system.h index aa2419fa..12106d57 100644 --- a/trunk-recorder/systems/system.h +++ b/trunk-recorder/systems/system.h @@ -120,6 +120,8 @@ public: virtual int channel_count() = 0; virtual int get_message_count() = 0; virtual void set_message_count(int count) = 0; + virtual void set_decode_rate(int rate) = 0; + virtual int get_decode_rate() = 0; virtual void add_channel(double channel) = 0; virtual void add_conventional_recorder(analog_recorder_sptr rec) = 0; virtual std::vector<analog_recorder_sptr> get_conventional_recorders() = 0; diff --git a/trunk-recorder/systems/system_impl.cc b/trunk-recorder/systems/system_impl.cc index ca8dad22..acff168b 100644 --- a/trunk-recorder/systems/system_impl.cc +++ b/trunk-recorder/systems/system_impl.cc @@ -98,6 +98,7 @@ System_impl::System_impl(int sys_num) { d_tps_enabled = false; retune_attempts = 0; message_count = 0; + decode_rate = 0; } void System_impl::set_xor_mask(unsigned long sys_id, unsigned long wacn, unsigned long nac) { @@ -368,6 +369,15 @@ int System_impl::get_message_count() { void System_impl::set_message_count(int count) { message_count = count; } + +void System_impl::set_decode_rate(int rate) { + decode_rate = rate; +} + +int System_impl::get_decode_rate() { + return decode_rate; +} + void System_impl::add_control_channel(double control_channel) { if (control_channels.size() == 0) { control_channels.push_back(control_channel); diff --git a/trunk-recorder/systems/system_impl.h b/trunk-recorder/systems/system_impl.h index 8f294449..61b516b4 100644 --- a/trunk-recorder/systems/system_impl.h +++ b/trunk-recorder/systems/system_impl.h @@ -62,6 +62,7 @@ public: std::string upload_script; int bcfy_system_id; int message_count; + int decode_rate; int retune_attempts; time_t last_message_time; std::string bandplan; @@ -174,6 +175,8 @@ public: int control_channel_count(); int get_message_count(); void set_message_count(int count); + int get_decode_rate(); + void set_decode_rate(int rate); void add_control_channel(double channel); double get_next_control_channel(); double get_current_control_channel(); |