diff options
| -rw-r--r-- | OutputUHD.cpp | 2 | ||||
| -rw-r--r-- | main.cpp | 14 | 
2 files changed, 15 insertions, 1 deletions
| diff --git a/OutputUHD.cpp b/OutputUHD.cpp index 255f63f..d37879b 100644 --- a/OutputUHD.cpp +++ b/OutputUHD.cpp @@ -49,7 +49,9 @@ OutputUHD::OutputUHD(double txgain, double rxgain, double samplerate) :      m_usrp = uhd::usrp::multi_usrp::make(device);      m_usrp->set_tx_rate(m_samplerate); +    MDEBUG("OutputUHD:Actual TX rate: %f\n", m_usrp->get_tx_rate());      m_usrp->set_rx_rate(m_samplerate); +    MDEBUG("OutputUHD:Actual RX rate: %f\n", m_usrp->get_rx_rate());      m_usrp->set_tx_freq(234.208e6);      double set_tx_frequency = m_usrp->get_tx_freq(); @@ -42,6 +42,17 @@ void sig_int_handler(int) {      running = false;  } +static int set_realtime_prio(int prio) +{ +    // Set thread priority to realtime +    const int policy = SCHED_RR; +    sched_param sp; +    sp.sched_priority = sched_get_priority_min(policy) + prio; +    int ret = pthread_setschedparam(pthread_self(), policy, &sp); +    return ret; +} + +  size_t read_samples_from_file(FILE* fd, std::vector<complexf>& samples, size_t count)  {      if (samples.size() < count) { @@ -180,7 +191,6 @@ void analyse_correlation()      }  } -  int main(int argc, char **argv)  {      double txgain = 0; @@ -207,6 +217,8 @@ int main(int argc, char **argv)          return -1;      } +    set_realtime_prio(1); +      std::string uri = argv[1];      zmq::context_t ctx; | 
