[hamradio-commits] [gnss-sdr] 85/303: Closing queues and improving TTFF report

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Mon Feb 13 22:35:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch master
in repository gnss-sdr.

commit 3583952a5c0a1f20e4f87dd3cb9e84ff38613e0d
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Mon Oct 3 11:42:54 2016 +0200

    Closing queues and improving TTFF report
---
 src/tests/system-tests/ttff_gps_l1.cc | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc
index 1c59fd7..19b5402 100644
--- a/src/tests/system-tests/ttff_gps_l1.cc
+++ b/src/tests/system-tests/ttff_gps_l1.cc
@@ -30,6 +30,7 @@
  * -------------------------------------------------------------------------
  */
 
+#include <error.h>
 #include <chrono>
 #include <cstdlib>
 #include <ctime>
@@ -251,11 +252,11 @@ void receive_msg()
     double ttff_msg = 0.0;
     int msgrcv_size = sizeof(msg.ttff);
     int msqid;
-    int msqid_stop;
+    int msqid_stop = -1;
     key_t key = 1101;
     key_t key_stop = 1102;
     // wait for the queue to be created
-    while((msqid = msgget(key, 0644)) == -1){}
+    if((msqid = msgget(key, 0644)) == -1){}
 
     if (msgrcv(msqid, &msg, msgrcv_size, 1, 0) != -1)
         {
@@ -265,7 +266,7 @@ void receive_msg()
                     TTFF_v.push_back(ttff_msg / (1000.0 / decimation_factor) );
                     LOG(INFO) << "Valid Time-To-First-Fix: " << ttff_msg / (1000.0 / decimation_factor ) << "[s]";
                     // Stop the receiver
-                    while((msqid_stop = msgget(key_stop, 0644)) == -1){}
+                    while((msqid_stop = msgget(key_stop, 0644 | IPC_CREAT))) == -1){}
                     double msgsend_size = sizeof(msg_stop.ttff);
                     msgsnd(msqid_stop, &msg_stop, msgsend_size, IPC_NOWAIT);
                 }
@@ -274,6 +275,10 @@ void receive_msg()
                 {
                     receive_msg();
                 }
+            else
+                {
+                    if(msqid_stop != -1) msgctl(msqid_stop, IPC_RMID, NULL);
+                }
         }
     return;
 }
@@ -325,6 +330,15 @@ void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector<double> & ttff_v,
     std::cout << "TTFF stdev: " << stdev << " [s]" << std::endl;
     std::cout << "Operating System: " << std::string(HOST_SYSTEM) << std::endl;
     std::cout << "Navigation mode: " << "3D" << std::endl;
+    std::string source = config_->property("SignalSource.implementation", "");
+    if(source.compare("UHD_Signal_Source"))
+        {
+            std::cout << "Source: File" << std::endl;
+        }
+    else
+        {
+            std::cout << "Source: Live" << std::endl;
+        }
     std::cout << "---------------------------" << std::endl;
 }
 
@@ -501,6 +515,7 @@ int main(int argc, char **argv)
     msgsend_size = sizeof(msg.ttff);
     msgsnd(sysv_msqid, &msg, msgsend_size, IPC_NOWAIT);
     receive_msg_thread.join();
+    msgctl(sysv_msqid, IPC_RMID, NULL);
     google::ShutDownCommandLineFlags();
     return res;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list