correctly fix script and record timing information

release/4.3a0
Varun Agrawal 2025-03-25 09:45:16 -04:00
parent c03dba8579
commit 47d370903c
1 changed files with 13 additions and 4 deletions

View File

@ -109,11 +109,10 @@ class Experiment {
std::cout << "Smoother update: " << newFactors_.size() << std::endl; std::cout << "Smoother update: " << newFactors_.size() << std::endl;
gttic_(SmootherUpdate); gttic_(SmootherUpdate);
clock_t beforeUpdate = clock(); clock_t beforeUpdate = clock();
auto linearized = newFactors_.linearize(initial_); smoother_.update(newFactors_, initial_, maxNrHypotheses);
smoother_.update(*linearized, initial_); clock_t afterUpdate = clock();
allFactors_.push_back(newFactors_); allFactors_.push_back(newFactors_);
newFactors_.resize(0); newFactors_.resize(0);
clock_t afterUpdate = clock();
return afterUpdate - beforeUpdate; return afterUpdate - beforeUpdate;
} }
@ -262,10 +261,20 @@ class Experiment {
std::string timeFileName = "Hybrid_City10000_time.txt"; std::string timeFileName = "Hybrid_City10000_time.txt";
outfileTime.open(timeFileName); outfileTime.open(timeFileName);
for (auto accTime : timeList) { for (auto accTime : timeList) {
outfileTime << accTime << std::endl; outfileTime << accTime / CLOCKS_PER_SEC << std::endl;
} }
outfileTime.close(); outfileTime.close();
std::cout << "Output " << timeFileName << " file." << std::endl; std::cout << "Output " << timeFileName << " file." << std::endl;
std::ofstream timingFile;
std::string timingFileName = "Hybrid_City10000_timing.txt";
timingFile.open(timingFileName);
for (size_t i = 0; i < smootherUpdateTimes.size(); i++) {
auto p = smootherUpdateTimes.at(i);
timingFile << p.first << ", " << p.second / CLOCKS_PER_SEC << std::endl;
}
timingFile.close();
std::cout << "Wrote timing information to " << timingFileName << std::endl;
} }
}; };