3 XCSoar Glide Computer - http://www.xcsoar.org/
4 Copyright (C) 2000-2013 The XCSoar Project
5 A detailed list of copyright holders can be found in the file "AUTHORS".
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "Engine/Trace/Trace.hpp"
24 #include "Contest/ContestManager.hpp"
25 #include "Printing.hpp"
26 #include "OS/Args.hpp"
27 #include "DebugReplay.hpp"
32 // Uncomment the following line to use the same trace size as LK8000.
33 //#define BENCHMARK_LK8000
35 #ifdef BENCHMARK_LK8000
36 static Trace
full_trace(0, Trace::null_time
, 100);
37 static Trace
triangle_trace(0, Trace::null_time
, 100);
38 static Trace
sprint_trace(0, 9000, 50);
40 static Trace
full_trace(0, Trace::null_time
, 512);
41 static Trace
triangle_trace(0, Trace::null_time
, 1024);
42 static Trace
sprint_trace(0, 9000, 128);
45 static ContestManager
olc_classic(Contest::OLC_CLASSIC
,
46 full_trace
, triangle_trace
, sprint_trace
);
47 static ContestManager
olc_fai(Contest::OLC_FAI
,
48 full_trace
, triangle_trace
, sprint_trace
);
49 static ContestManager
olc_sprint(Contest::OLC_SPRINT
,
50 full_trace
, triangle_trace
, sprint_trace
);
51 static ContestManager
olc_league(Contest::OLC_LEAGUE
,
52 full_trace
, triangle_trace
, sprint_trace
);
53 static ContestManager
olc_plus(Contest::OLC_PLUS
,
54 full_trace
, triangle_trace
, sprint_trace
);
55 static ContestManager
dmst(Contest::DMST
,
56 full_trace
, triangle_trace
, sprint_trace
);
57 static ContestManager
xcontest(Contest::XCONTEST
,
58 full_trace
, triangle_trace
, sprint_trace
);
59 static ContestManager
sis_at(Contest::SIS_AT
,
60 full_trace
, triangle_trace
, sprint_trace
);
61 static ContestManager
olc_netcoupe(Contest::NET_COUPE
,
62 full_trace
, triangle_trace
, sprint_trace
);
65 TestOLC(DebugReplay
&replay
)
67 bool released
= false;
69 for (int i
= 1; replay
.Next(); i
++) {
75 const MoreData
&basic
= replay
.Basic();
76 if (!basic
.time_available
|| !basic
.location_available
||
77 !basic
.NavAltitudeAvailable())
80 if (!released
&& !negative(replay
.Calculated().flight
.release_time
)) {
83 triangle_trace
.EraseEarlierThan(replay
.Calculated().flight
.release_time
);
84 full_trace
.EraseEarlierThan(replay
.Calculated().flight
.release_time
);
85 sprint_trace
.EraseEarlierThan(replay
.Calculated().flight
.release_time
);
88 const TracePoint
point(basic
);
89 triangle_trace
.push_back(point
);
90 full_trace
.push_back(point
);
91 sprint_trace
.push_back(point
);
93 olc_sprint
.UpdateIdle();
94 olc_league
.UpdateIdle();
97 olc_classic
.SolveExhaustive();
98 olc_fai
.SolveExhaustive();
99 olc_league
.SolveExhaustive();
100 olc_plus
.SolveExhaustive();
101 dmst
.SolveExhaustive();
102 xcontest
.SolveExhaustive();
103 sis_at
.SolveExhaustive();
104 olc_netcoupe
.SolveExhaustive();
108 std::cout
<< "classic\n";
109 PrintHelper::print(olc_classic
.GetStats().GetResult());
110 std::cout
<< "league\n";
111 std::cout
<< "# league\n";
112 PrintHelper::print(olc_league
.GetStats().GetResult(0));
113 std::cout
<< "# classic\n";
114 PrintHelper::print(olc_league
.GetStats().GetResult(1));
115 std::cout
<< "fai\n";
116 PrintHelper::print(olc_fai
.GetStats().GetResult());
117 std::cout
<< "sprint\n";
118 PrintHelper::print(olc_sprint
.GetStats().GetResult());
119 std::cout
<< "plus\n";
120 std::cout
<< "# classic\n";
121 PrintHelper::print(olc_plus
.GetStats().GetResult(0));
122 std::cout
<< "# triangle\n";
123 PrintHelper::print(olc_plus
.GetStats().GetResult(1));
124 std::cout
<< "# plus\n";
125 PrintHelper::print(olc_plus
.GetStats().GetResult(2));
127 std::cout
<< "dmst\n";
128 PrintHelper::print(dmst
.GetStats().GetResult());
130 std::cout
<< "xcontest\n";
131 std::cout
<< "# free\n";
132 PrintHelper::print(xcontest
.GetStats().GetResult(0));
133 std::cout
<< "# triangle\n";
134 PrintHelper::print(xcontest
.GetStats().GetResult(1));
136 std::cout
<< "sis_at\n";
137 PrintHelper::print(sis_at
.GetStats().GetResult(0));
139 std::cout
<< "netcoupe\n";
140 PrintHelper::print(olc_netcoupe
.GetStats().GetResult());
148 olc_netcoupe
.Reset();
150 sprint_trace
.clear();
156 int main(int argc
, char **argv
)
158 Args
args(argc
, argv
, "DRIVER FILE");
159 DebugReplay
*replay
= CreateDebugReplay(args
);
165 int result
= TestOLC(*replay
);