Merge lp:~thomas-voss/location-service/make-trials-in-gps-test-configurable-and-output-test-summary into lp:location-service/trunk

Proposed by Thomas Voß
Status: Needs review
Proposed branch: lp:~thomas-voss/location-service/make-trials-in-gps-test-configurable-and-output-test-summary
Merge into: lp:location-service/trunk
Diff against target: 104 lines (+25/-6)
1 file modified
tests/gps_provider_test.cpp (+25/-6)
To merge this branch: bzr merge lp:~thomas-voss/location-service/make-trials-in-gps-test-configurable-and-output-test-summary
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+237375@code.launchpad.net

Commit message

Make the number of trials in {A}GPS tests configurable via an environment variable.
Add output of raw timing values to {A}GPS tests.

Description of the change

Make the number of trials in {A}GPS tests configurable via an environment variable.
Add output of raw timing values to {A}GPS tests.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

113. By Thomas Voß

Make the number of trials in {A}GPS tests configurable via an environment variable.
Add output of raw timing values to {A}GPS tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/gps_provider_test.cpp'
--- tests/gps_provider_test.cpp 2014-07-15 15:04:22 +0000
+++ tests/gps_provider_test.cpp 2014-10-07 08:41:36 +0000
@@ -471,6 +471,8 @@
471 static constexpr const char* supl_host{"supl_host"};471 static constexpr const char* supl_host{"supl_host"};
472 // SUPL port472 // SUPL port
473 static constexpr const char* supl_port{"supl_port"};473 static constexpr const char* supl_port{"supl_port"};
474 // The number of trials to execute for statistics calculation.
475 static constexpr const char* trial_count{"trial_count"};
474476
475 static location::ProgramOptions init_options()477 static location::ProgramOptions init_options()
476 {478 {
@@ -515,6 +517,10 @@
515 "SUPL port to use for positioning benchmarks.",517 "SUPL port to use for positioning benchmarks.",
516 std::uint16_t{7476});518 std::uint16_t{7476});
517519
520 options.add(trial_count,
521 "The number of trials to execute for statistics calculation.",
522 std::uint32_t{3});
523
518 return options;524 return options;
519 }525 }
520526
@@ -598,6 +604,10 @@
598 options.value_for_key<double>(ref_accuracy) * location::units::Meters604 options.value_for_key<double>(ref_accuracy) * location::units::Meters
599 }605 }
600 };606 };
607 std::uint32_t trials
608 {
609 options.value_for_key<std::uint32_t>(trial_count)
610 };
601};611};
602}612}
603613
@@ -623,6 +633,7 @@
623// HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware633// HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware
624TEST_F(HardwareAbstractionLayerFixture, time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware)634TEST_F(HardwareAbstractionLayerFixture, time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware)
625{635{
636
626 typedef boost::accumulators::accumulator_set<637 typedef boost::accumulators::accumulator_set<
627 double,638 double,
628 boost::accumulators::stats<639 boost::accumulators::stats<
@@ -634,8 +645,7 @@
634 using boost::accumulators::mean;645 using boost::accumulators::mean;
635 using boost::accumulators::variance;646 using boost::accumulators::variance;
636647
637 static const unsigned int trials = 3;648 std::vector<std::chrono::microseconds> raw_values;
638
639 Statistics stats;649 Statistics stats;
640 auto hal = gps::HardwareAbstractionLayer::create_default_instance();650 auto hal = gps::HardwareAbstractionLayer::create_default_instance();
641651
@@ -701,8 +711,10 @@
701 hal->stop_positioning();711 hal->stop_positioning();
702 }712 }
703 auto stop = std::chrono::duration_cast<std::chrono::microseconds>(location::Clock::now().time_since_epoch());713 auto stop = std::chrono::duration_cast<std::chrono::microseconds>(location::Clock::now().time_since_epoch());
714 auto duration = stop - start;
704715
705 stats((stop - start).count());716 raw_values.push_back(duration);
717 stats(duration.count());
706 }718 }
707719
708 std::cout << "Mean time to first fix in [ms]: "720 std::cout << "Mean time to first fix in [ms]: "
@@ -715,6 +727,9 @@
715 std::chrono::microseconds(727 std::chrono::microseconds(
716 static_cast<std::uint64_t>(variance(stats)))).count()728 static_cast<std::uint64_t>(variance(stats)))).count()
717 << std::endl;729 << std::endl;
730 std::cout << "Time to first fix in [ms] per trial: " << std::endl;
731 for(const auto& ttff : raw_values)
732 std::cout << "\t" << ttff.count() << std::endl;
718}733}
719734
720// HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware735// HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware
@@ -733,8 +748,7 @@
733 using boost::accumulators::mean;748 using boost::accumulators::mean;
734 using boost::accumulators::variance;749 using boost::accumulators::variance;
735750
736 static const unsigned int trials = 3;751 std::vector<std::chrono::microseconds> raw_values;
737
738 Statistics stats;752 Statistics stats;
739 auto hal = gps::HardwareAbstractionLayer::create_default_instance();753 auto hal = gps::HardwareAbstractionLayer::create_default_instance();
740754
@@ -823,8 +837,10 @@
823837
824 }838 }
825 auto stop = std::chrono::duration_cast<std::chrono::microseconds>(location::Clock::now().time_since_epoch());839 auto stop = std::chrono::duration_cast<std::chrono::microseconds>(location::Clock::now().time_since_epoch());
840 auto duration = stop - start;
826841
827 stats((stop - start).count());842 raw_values.push_back(duration);
843 stats(duration.count());
828 }844 }
829845
830 std::cout << "Mean time to first fix in [ms]: "846 std::cout << "Mean time to first fix in [ms]: "
@@ -837,5 +853,8 @@
837 std::chrono::microseconds(853 std::chrono::microseconds(
838 static_cast<std::uint64_t>(variance(stats)))).count()854 static_cast<std::uint64_t>(variance(stats)))).count()
839 << std::endl;855 << std::endl;
856 std::cout << "Time to first fix in [ms] per trial: " << std::endl;
857 for(const auto& ttff : raw_values)
858 std::cout << "\t" << ttff.count() << std::endl;
840}859}
841860

Subscribers

People subscribed via source and target branches