Commit c07cddb3 authored by Alexander Ryndin's avatar Alexander Ryndin
Browse files

add warm up (potential DLL loading)

parent d5a181d2
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <iostream> #include <iostream>
#include <chrono> #include <chrono>
void execute(de_rwth_armin_modeling_autopilot_motion_motionPlanning&, double&, double&);
// https://stackoverflow.com/a/19471595/1432357 // https://stackoverflow.com/a/19471595/1432357
class Timer class Timer
{ {
...@@ -30,19 +32,12 @@ int main () { ...@@ -30,19 +32,12 @@ int main () {
const int N = 1000000; const int N = 1000000;
double _currentDirectionX = 0.0; double _currentDirectionX = 0.0;
double _desiredDirectionX = 1.0; double _desiredDirectionX = 1.0;
// warm up, load DLLs if needed
execute(motionPlanning, _currentDirectionX, _desiredDirectionX);
std::cout << "running benchmark\n"; std::cout << "running benchmark\n";
Timer tmr; Timer tmr;
for (int i=0; i<N; i++) { for (int i=0; i<N; i++) {
motionPlanning.currentDirectionX = _currentDirectionX; execute(motionPlanning, _currentDirectionX, _desiredDirectionX);
motionPlanning.currentDirectionY = 1.0;
motionPlanning.desiredDirectionX = _desiredDirectionX;
motionPlanning.desiredDirectionY = 1.0;
motionPlanning.signedDistanceToTrajectory = 0.15;
motionPlanning.currentVelocity = 10.0;
motionPlanning.desiredVelocity = 11.0;
motionPlanning.execute();
_currentDirectionX = motionPlanning.steering;
_desiredDirectionX = motionPlanning.brakes;
} }
double t = tmr.elapsed(); double t = tmr.elapsed();
double avgDuration = t / N; double avgDuration = t / N;
...@@ -50,4 +45,19 @@ int main () { ...@@ -50,4 +45,19 @@ int main () {
return 0; return 0;
} }
void execute(de_rwth_armin_modeling_autopilot_motion_motionPlanning& cmp,
double& _currentDirectionX,
double& _desiredDirectionX) {
cmp.currentDirectionX = _currentDirectionX;
cmp.currentDirectionY = 1.0;
cmp.desiredDirectionX = _desiredDirectionX;
cmp.desiredDirectionY = 1.0;
cmp.signedDistanceToTrajectory = 0.15;
cmp.currentVelocity = 10.0;
cmp.desiredVelocity = 11.0;
cmp.execute();
_currentDirectionX = cmp.steering;
_desiredDirectionX = cmp.brakes;
}
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment