aboutsummaryrefslogtreecommitdiffstats
path: root/host/examples
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2019-08-06 14:40:47 -0500
committerMartin Braun <martin.braun@ettus.com>2019-10-22 16:18:46 -0700
commit60a70f7142047b44cfec6d58ba77f5c7a81f1750 (patch)
tree445d5228ff98c985cdef4c9bd06e3595948aeace /host/examples
parent14c5812fd773108a75f568d11d9ae4d833de1aeb (diff)
downloaduhd-60a70f7142047b44cfec6d58ba77f5c7a81f1750.tar.gz
uhd-60a70f7142047b44cfec6d58ba77f5c7a81f1750.tar.bz2
uhd-60a70f7142047b44cfec6d58ba77f5c7a81f1750.zip
examples: remove thread priority elevation
Remove UHD call to elevate thread priority to realtime. Setting all threads to the same realtime priority can cause the threads to not share access to the network interface fairly, which adversely affects operation of the worker threads in UHD.
Diffstat (limited to 'host/examples')
-rw-r--r--host/examples/benchmark_rate.cpp6
-rw-r--r--host/examples/benchmark_streamer.cpp2
-rw-r--r--host/examples/gpio.cpp2
-rw-r--r--host/examples/init_usrp/init_usrp.cpp2
-rw-r--r--host/examples/latency_test.cpp2
-rw-r--r--host/examples/network_relay.cpp4
-rw-r--r--host/examples/rfnoc_nullsource_ce_rx.cpp2
-rw-r--r--host/examples/rfnoc_rx_to_file.cpp2
-rw-r--r--host/examples/rx_ascii_art_dft.cpp2
-rw-r--r--host/examples/rx_multi_samples.cpp2
-rw-r--r--host/examples/rx_samples_c.c4
-rw-r--r--host/examples/rx_samples_to_file.cpp2
-rw-r--r--host/examples/rx_samples_to_udp.cpp2
-rw-r--r--host/examples/rx_timed_samples.cpp2
-rw-r--r--host/examples/sync_to_gps.cpp2
-rw-r--r--host/examples/test_clock_synch.cpp2
-rw-r--r--host/examples/test_messages.cpp2
-rw-r--r--host/examples/test_pps_input.cpp2
-rw-r--r--host/examples/test_timed_commands.cpp2
-rw-r--r--host/examples/twinrx_freq_hopping.cpp2
-rw-r--r--host/examples/tx_bursts.cpp2
-rw-r--r--host/examples/tx_samples_c.c4
-rw-r--r--host/examples/tx_samples_from_file.cpp2
-rw-r--r--host/examples/tx_timed_samples.cpp2
-rw-r--r--host/examples/tx_waveforms.cpp2
-rw-r--r--host/examples/txrx_loopback_to_file.cpp2
26 files changed, 0 insertions, 62 deletions
diff --git a/host/examples/benchmark_rate.cpp b/host/examples/benchmark_rate.cpp
index 6c2c6868d..539958ede 100644
--- a/host/examples/benchmark_rate.cpp
+++ b/host/examples/benchmark_rate.cpp
@@ -65,8 +65,6 @@ void benchmark_rx_rate(uhd::usrp::multi_usrp::sptr usrp,
const boost::posix_time::ptime& start_time,
std::atomic<bool>& burst_timer_elapsed)
{
- uhd::set_thread_priority_safe();
-
// print pre-test summary
std::cout << boost::format("[%s] Testing receive rate %f Msps on %u channels") % NOW()
% (usrp->get_rx_rate() / 1e6) % rx_stream->get_num_channels()
@@ -192,8 +190,6 @@ void benchmark_tx_rate(uhd::usrp::multi_usrp::sptr usrp,
const boost::posix_time::ptime& start_time,
bool random_nsamps = false)
{
- uhd::set_thread_priority_safe();
-
// print pre-test summary
std::cout << boost::format("[%s] Testing transmit rate %f Msps on %u channels")
% NOW() % (usrp->get_tx_rate() / 1e6) % tx_stream->get_num_channels()
@@ -297,8 +293,6 @@ void benchmark_tx_rate_async_helper(uhd::tx_streamer::sptr tx_stream,
**********************************************************************/
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
std::string rx_subdev, tx_subdev;
diff --git a/host/examples/benchmark_streamer.cpp b/host/examples/benchmark_streamer.cpp
index 44851825a..2b82acf7e 100644
--- a/host/examples/benchmark_streamer.cpp
+++ b/host/examples/benchmark_streamer.cpp
@@ -709,8 +709,6 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
return EXIT_SUCCESS;
}
- uhd::set_thread_priority_safe();
-
std::cout << boost::format("Creating the usrp device with: %s...") % args
<< std::endl;
uhd::device3::sptr usrp = uhd::device3::make(args);
diff --git a/host/examples/gpio.cpp b/host/examples/gpio.cpp
index 0ed8d01ef..5576fa7a4 100644
--- a/host/examples/gpio.cpp
+++ b/host/examples/gpio.cpp
@@ -131,8 +131,6 @@ void output_reg_values(const std::string bank,
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
std::string cpu, otw;
diff --git a/host/examples/init_usrp/init_usrp.cpp b/host/examples/init_usrp/init_usrp.cpp
index 62515b538..91fc87f4a 100644
--- a/host/examples/init_usrp/init_usrp.cpp
+++ b/host/examples/init_usrp/init_usrp.cpp
@@ -21,8 +21,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
diff --git a/host/examples/latency_test.cpp b/host/examples/latency_test.cpp
index 69d34dbff..d46e22395 100644
--- a/host/examples/latency_test.cpp
+++ b/host/examples/latency_test.cpp
@@ -17,8 +17,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
size_t nsamps;
diff --git a/host/examples/network_relay.cpp b/host/examples/network_relay.cpp
index 464d2084d..bf2ac9255 100644
--- a/host/examples/network_relay.cpp
+++ b/host/examples/network_relay.cpp
@@ -128,7 +128,6 @@ private:
void server_thread(void)
{
- uhd::set_thread_priority_safe();
std::cout << " entering server_thread..." << std::endl;
wait_for_thread.notify_one(); // notify constructor that this thread has started
std::vector<char> buff(insane_mtu);
@@ -157,7 +156,6 @@ private:
void client_thread(void)
{
- uhd::set_thread_priority_safe();
std::cout << " entering client_thread..." << std::endl;
wait_for_thread.notify_one(); // notify constructor that this thread has started
std::vector<char> buff(insane_mtu);
@@ -188,8 +186,6 @@ private:
**********************************************************************/
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string addr;
std::string bind;
diff --git a/host/examples/rfnoc_nullsource_ce_rx.cpp b/host/examples/rfnoc_nullsource_ce_rx.cpp
index 16eb49c7b..7dd21905f 100644
--- a/host/examples/rfnoc_nullsource_ce_rx.cpp
+++ b/host/examples/rfnoc_nullsource_ce_rx.cpp
@@ -206,8 +206,6 @@ void pretty_print_flow_graph(std::vector<std::string> blocks)
///////////////////// MAIN ////////////////////////////////////////////////////
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, file, format, nullid, blockid, blockid2;
size_t total_num_samps, spb, spp;
diff --git a/host/examples/rfnoc_rx_to_file.cpp b/host/examples/rfnoc_rx_to_file.cpp
index 98b0a5479..12e774d88 100644
--- a/host/examples/rfnoc_rx_to_file.cpp
+++ b/host/examples/rfnoc_rx_to_file.cpp
@@ -231,8 +231,6 @@ bool check_locked_sensor(std::vector<std::string> sensor_names,
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, file, format, ant, subdev, ref, wirefmt, streamargs, radio_args,
block_id, block_args;
diff --git a/host/examples/rx_ascii_art_dft.cpp b/host/examples/rx_ascii_art_dft.cpp
index a82d8ee49..2f8c33947 100644
--- a/host/examples/rx_ascii_art_dft.cpp
+++ b/host/examples/rx_ascii_art_dft.cpp
@@ -23,8 +23,6 @@ using std::chrono::high_resolution_clock;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, ant, subdev, ref;
size_t num_bins;
diff --git a/host/examples/rx_multi_samples.cpp b/host/examples/rx_multi_samples.cpp
index f395b69b7..a2aa7f436 100644
--- a/host/examples/rx_multi_samples.cpp
+++ b/host/examples/rx_multi_samples.cpp
@@ -20,8 +20,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, sync, subdev, channel_list;
double seconds_in_future;
diff --git a/host/examples/rx_samples_c.c b/host/examples/rx_samples_c.c
index 1cabafc9d..28d2629d9 100644
--- a/host/examples/rx_samples_c.c
+++ b/host/examples/rx_samples_c.c
@@ -35,10 +35,6 @@ void print_help(void){
int main(int argc, char* argv[])
{
- if(uhd_set_thread_priority(uhd_default_thread_priority, true)){
- fprintf(stderr, "Unable to set thread priority. Continuing anyway.\n");
- }
-
int option = 0;
double freq = 500e6;
double rate = 1e6;
diff --git a/host/examples/rx_samples_to_file.cpp b/host/examples/rx_samples_to_file.cpp
index 66ec284de..1eaa57a25 100644
--- a/host/examples/rx_samples_to_file.cpp
+++ b/host/examples/rx_samples_to_file.cpp
@@ -215,8 +215,6 @@ bool check_locked_sensor(std::vector<std::string> sensor_names,
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, file, type, ant, subdev, ref, wirefmt;
size_t channel, total_num_samps, spb;
diff --git a/host/examples/rx_samples_to_udp.cpp b/host/examples/rx_samples_to_udp.cpp
index 6dd04ec6a..a4deb9dcf 100644
--- a/host/examples/rx_samples_to_udp.cpp
+++ b/host/examples/rx_samples_to_udp.cpp
@@ -22,8 +22,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, file, ant, subdev, ref;
size_t total_num_samps;
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp
index 6411cb4cc..020e7fc6b 100644
--- a/host/examples/rx_timed_samples.cpp
+++ b/host/examples/rx_timed_samples.cpp
@@ -18,8 +18,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
std::string wire;
diff --git a/host/examples/sync_to_gps.cpp b/host/examples/sync_to_gps.cpp
index 952e7f8b3..3f19d9b13 100644
--- a/host/examples/sync_to_gps.cpp
+++ b/host/examples/sync_to_gps.cpp
@@ -35,8 +35,6 @@ void print_notes(void)
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
std::string args;
// Set up program options
diff --git a/host/examples/test_clock_synch.cpp b/host/examples/test_clock_synch.cpp
index 96ebd05a6..8556063d7 100644
--- a/host/examples/test_clock_synch.cpp
+++ b/host/examples/test_clock_synch.cpp
@@ -30,8 +30,6 @@ void get_usrp_time(multi_usrp::sptr usrp, size_t mboard, std::vector<int64_t>* t
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// Variables to be set by command line options
std::string clock_args, usrp_args;
uint32_t max_interval, num_tests;
diff --git a/host/examples/test_messages.cpp b/host/examples/test_messages.cpp
index 4d4771900..0d0e958b8 100644
--- a/host/examples/test_messages.cpp
+++ b/host/examples/test_messages.cpp
@@ -275,8 +275,6 @@ void flush_recv(uhd::rx_streamer::sptr rx_stream)
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
size_t ntests;
diff --git a/host/examples/test_pps_input.cpp b/host/examples/test_pps_input.cpp
index 24171aa04..bc4651419 100644
--- a/host/examples/test_pps_input.cpp
+++ b/host/examples/test_pps_input.cpp
@@ -19,8 +19,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
std::string time_source;
diff --git a/host/examples/test_timed_commands.cpp b/host/examples/test_timed_commands.cpp
index 5fe8d818c..d27c0e8a4 100644
--- a/host/examples/test_timed_commands.cpp
+++ b/host/examples/test_timed_commands.cpp
@@ -17,8 +17,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
diff --git a/host/examples/twinrx_freq_hopping.cpp b/host/examples/twinrx_freq_hopping.cpp
index ea350928c..d32a3e660 100644
--- a/host/examples/twinrx_freq_hopping.cpp
+++ b/host/examples/twinrx_freq_hopping.cpp
@@ -101,8 +101,6 @@ static void write_fft_to_file(const std::string& fft_path)
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// Program options
std::string args, fft_path, subdev, ant;
double rate, gain;
diff --git a/host/examples/tx_bursts.cpp b/host/examples/tx_bursts.cpp
index 4be4e694b..b74a482b7 100644
--- a/host/examples/tx_bursts.cpp
+++ b/host/examples/tx_bursts.cpp
@@ -26,8 +26,6 @@ void sig_int_handler(int)
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, channel_list;
double seconds_in_future;
diff --git a/host/examples/tx_samples_c.c b/host/examples/tx_samples_c.c
index f9001f2f1..f7b600c67 100644
--- a/host/examples/tx_samples_c.c
+++ b/host/examples/tx_samples_c.c
@@ -92,10 +92,6 @@ int main(int argc, char* argv[]){
}
}
- if(uhd_set_thread_priority(uhd_default_thread_priority, true)){
- fprintf(stderr, "Unable to set thread priority. Continuing anyway.\n");
- }
-
if (!device_args)
device_args = strdup("");
diff --git a/host/examples/tx_samples_from_file.cpp b/host/examples/tx_samples_from_file.cpp
index d2de72a68..382d42a40 100644
--- a/host/examples/tx_samples_from_file.cpp
+++ b/host/examples/tx_samples_from_file.cpp
@@ -52,8 +52,6 @@ void send_from_file(
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, file, type, ant, subdev, ref, wirefmt, channel;
size_t spb;
diff --git a/host/examples/tx_timed_samples.cpp b/host/examples/tx_timed_samples.cpp
index 5ec5dbc23..afb2ac5b7 100644
--- a/host/examples/tx_timed_samples.cpp
+++ b/host/examples/tx_timed_samples.cpp
@@ -18,8 +18,6 @@ namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args;
std::string wire;
diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp
index 5eb52f34c..1bc762f57 100644
--- a/host/examples/tx_waveforms.cpp
+++ b/host/examples/tx_waveforms.cpp
@@ -38,8 +38,6 @@ void sig_int_handler(int)
**********************************************************************/
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// variables to be set by po
std::string args, wave_type, ant, subdev, ref, pps, otw, channel_list;
uint64_t total_num_samps;
diff --git a/host/examples/txrx_loopback_to_file.cpp b/host/examples/txrx_loopback_to_file.cpp
index d1d0ae615..d23e9a0d2 100644
--- a/host/examples/txrx_loopback_to_file.cpp
+++ b/host/examples/txrx_loopback_to_file.cpp
@@ -190,8 +190,6 @@ void recv_to_file(uhd::usrp::multi_usrp::sptr usrp,
**********************************************************************/
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
// transmit variables to be set by po
std::string tx_args, wave_type, tx_ant, tx_subdev, ref, otw, tx_channels;
double tx_rate, tx_freq, tx_gain, wave_freq, tx_bw;