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
1=== modified file 'tests/gps_provider_test.cpp'
2--- tests/gps_provider_test.cpp 2014-07-15 15:04:22 +0000
3+++ tests/gps_provider_test.cpp 2014-10-07 08:41:36 +0000
4@@ -471,6 +471,8 @@
5 static constexpr const char* supl_host{"supl_host"};
6 // SUPL port
7 static constexpr const char* supl_port{"supl_port"};
8+ // The number of trials to execute for statistics calculation.
9+ static constexpr const char* trial_count{"trial_count"};
10
11 static location::ProgramOptions init_options()
12 {
13@@ -515,6 +517,10 @@
14 "SUPL port to use for positioning benchmarks.",
15 std::uint16_t{7476});
16
17+ options.add(trial_count,
18+ "The number of trials to execute for statistics calculation.",
19+ std::uint32_t{3});
20+
21 return options;
22 }
23
24@@ -598,6 +604,10 @@
25 options.value_for_key<double>(ref_accuracy) * location::units::Meters
26 }
27 };
28+ std::uint32_t trials
29+ {
30+ options.value_for_key<std::uint32_t>(trial_count)
31+ };
32 };
33 }
34
35@@ -623,6 +633,7 @@
36 // HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware
37 TEST_F(HardwareAbstractionLayerFixture, time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware)
38 {
39+
40 typedef boost::accumulators::accumulator_set<
41 double,
42 boost::accumulators::stats<
43@@ -634,8 +645,7 @@
44 using boost::accumulators::mean;
45 using boost::accumulators::variance;
46
47- static const unsigned int trials = 3;
48-
49+ std::vector<std::chrono::microseconds> raw_values;
50 Statistics stats;
51 auto hal = gps::HardwareAbstractionLayer::create_default_instance();
52
53@@ -701,8 +711,10 @@
54 hal->stop_positioning();
55 }
56 auto stop = std::chrono::duration_cast<std::chrono::microseconds>(location::Clock::now().time_since_epoch());
57+ auto duration = stop - start;
58
59- stats((stop - start).count());
60+ raw_values.push_back(duration);
61+ stats(duration.count());
62 }
63
64 std::cout << "Mean time to first fix in [ms]: "
65@@ -715,6 +727,9 @@
66 std::chrono::microseconds(
67 static_cast<std::uint64_t>(variance(stats)))).count()
68 << std::endl;
69+ std::cout << "Time to first fix in [ms] per trial: " << std::endl;
70+ for(const auto& ttff : raw_values)
71+ std::cout << "\t" << ttff.count() << std::endl;
72 }
73
74 // HardwareAbstractionLayerFixture.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware
75@@ -733,8 +748,7 @@
76 using boost::accumulators::mean;
77 using boost::accumulators::variance;
78
79- static const unsigned int trials = 3;
80-
81+ std::vector<std::chrono::microseconds> raw_values;
82 Statistics stats;
83 auto hal = gps::HardwareAbstractionLayer::create_default_instance();
84
85@@ -823,8 +837,10 @@
86
87 }
88 auto stop = std::chrono::duration_cast<std::chrono::microseconds>(location::Clock::now().time_since_epoch());
89+ auto duration = stop - start;
90
91- stats((stop - start).count());
92+ raw_values.push_back(duration);
93+ stats(duration.count());
94 }
95
96 std::cout << "Mean time to first fix in [ms]: "
97@@ -837,5 +853,8 @@
98 std::chrono::microseconds(
99 static_cast<std::uint64_t>(variance(stats)))).count()
100 << std::endl;
101+ std::cout << "Time to first fix in [ms] per trial: " << std::endl;
102+ for(const auto& ttff : raw_values)
103+ std::cout << "\t" << ttff.count() << std::endl;
104 }
105

Subscribers

People subscribed via source and target branches