[hamradio-commits] [gnss-sdr] 77/303: Add hot start TTFF

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Mon Feb 13 22:35:49 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 b3eab47604e77925e64bb9bbf83023838b1a1e0c
Author: Carles Fernandez <carles.fernandez at gmail.com>
Date:   Sun Oct 2 21:24:46 2016 +0200

    Add hot start TTFF
---
 src/tests/system-tests/ttff_gps_l1.cc | 66 +++++++++++++++++++++++++++++++++--
 1 file changed, 64 insertions(+), 2 deletions(-)

diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc
index 2dd76c7..aa88d63 100644
--- a/src/tests/system-tests/ttff_gps_l1.cc
+++ b/src/tests/system-tests/ttff_gps_l1.cc
@@ -63,13 +63,13 @@ concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
 concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
 
 std::vector<double> TTFF_v;
+const int decimation_factor = 1;
 
 typedef struct  {
     long mtype; // required by SysV message
     double ttff;
 } ttff_msgbuf;
 
-const int decimation_factor = 1;
 
 class TTFF_GPS_L1_CA_Test: public ::testing::Test
 {
@@ -385,6 +385,69 @@ TEST_F(TTFF_GPS_L1_CA_Test, ColdStart)
 }
 
 
+TEST_F(TTFF_GPS_L1_CA_Test, HotStart)
+{
+    unsigned int num_measurements = 0;
+    TTFF_v.clear();
+
+    config_2();
+    // Ensure Hot Start
+    config2->set_property("GNSS-SDR.SUPL_gps_enabled", "true");
+    config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "true");
+    config2->set_property("PVT.flag_rtcm_server", "false");
+
+    for(int n = 0; n < FLAGS_num_measurements; n++)
+        {
+            // Create a new ControlThread object with a smart pointer
+            std::unique_ptr<ControlThread> control_thread(new ControlThread(config2));
+
+            // record startup time
+            struct timeval tv;
+            gettimeofday(&tv, NULL);
+            long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
+
+            std::cout << "Starting measurement " << num_measurements + 1 << " / " << FLAGS_num_measurements << std::endl;
+
+            // start receiver
+            try
+            {
+                    control_thread->run();
+            }
+            catch( boost::exception & e )
+            {
+                    std::cout << "Boost exception: " << boost::diagnostic_information(e);
+            }
+            catch(std::exception const&  ex)
+            {
+                    std::cout  << "STD exception: " << ex.what();
+            }
+
+            // stop clock
+            gettimeofday(&tv, NULL);
+            long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
+            double ttff = static_cast<double>(end - begin) / 1000000.0;
+
+            std::shared_ptr<GNSSFlowgraph> flowgraph = control_thread->flowgraph();
+            EXPECT_FALSE(flowgraph->running());
+
+            num_measurements = num_measurements + 1;
+            std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds." << std::endl;
+            if(n < FLAGS_num_measurements - 1)
+                {
+                    std::srand(std::time(0)); // use current time as seed for random generator
+                    int random_variable = std::rand();
+                    float random_variable_0_1 = static_cast<float>(random_variable) / static_cast<float>( RAND_MAX );
+                    int random_delay_s = static_cast<int>(random_variable_0_1 * 25.0);
+                    std::cout << "Waiting a random amount of time (from 5 to 30 s) to start new measurement... " << std::endl;
+                    std::cout << "This time will wait " << random_delay_s + 5 << " s." << std::endl << std::endl;
+                    std::this_thread::sleep_until(std::chrono::system_clock::now() + std::chrono::seconds(5) + std::chrono::seconds(random_delay_s));
+                }
+        }
+
+    // Print TTFF report
+    print_TTFF_report(TTFF_v, config);
+}
+
 
 int main(int argc, char **argv)
 {
@@ -406,7 +469,6 @@ int main(int argc, char **argv)
         throw new std::exception();
     }
 
-
     // Start queue thread
     std::thread receive_msg_thread(receive_msg);
 

-- 
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