Commit 22b48b4f authored by Cedric Caffy's avatar Cedric Caffy
Browse files

[lto_rao] Added a timer to measure the execution time of the RAO algorithm...

[lto_rao] Added a timer to measure the execution time of the RAO algorithm (instanciation + execution)
parent 27c89f81
......@@ -31,7 +31,7 @@ EnterpriseRAOAlgorithm::~EnterpriseRAOAlgorithm() {
}
std::vector<uint64_t> EnterpriseRAOAlgorithm::performRAO(const std::vector<std::unique_ptr<cta::RetrieveJob> >& jobs) {
cta::utils::Timer totalTime;
cta::utils::Timer totalTimer;
std::vector<uint64_t> raoOrder;
uint64_t njobs = jobs.size();
uint32_t block_size = c_blockSize;
......@@ -69,7 +69,7 @@ std::vector<uint64_t> EnterpriseRAOAlgorithm::performRAO(const std::vector<std::
raoOrder.push_back(id);
}
files.clear();
m_raoTimings.insertAndReset("totalTime",totalTime);
m_raoTimings.insertAndReset("RAOAlgorithmTime",totalTimer);
return raoOrder;
}
......
......@@ -42,7 +42,7 @@ std::vector<uint64_t> LinearRAOAlgorithm::performRAO(const std::vector<std::uniq
return jobs[index1]->selectedTapeFile().fSeq < jobs[index2]->selectedTapeFile().fSeq;
});
m_raoTimings.insertAndReset("vectorSortingTime",t);
m_raoTimings.insertAndReset("totalTime",totalTimer);
m_raoTimings.insertAndReset("RAOAlgorithmTime",totalTimer);
return raoIndices;
}
......
......@@ -24,6 +24,7 @@
#include "RAOAlgorithmFactoryFactory.hpp"
#include "catalogue/Catalogue.hpp"
#include "LinearRAOAlgorithm.hpp"
#include "common/Timer.hpp"
namespace castor { namespace tape { namespace tapeserver { namespace rao {
......@@ -104,6 +105,7 @@ RAOParams RAOManager::getRAOParams() const {
}
std::vector<uint64_t> RAOManager::queryRAO(const std::vector<std::unique_ptr<cta::RetrieveJob>> & jobs, cta::log::LogContext & lc){
cta::utils::Timer totalTimer;
RAOAlgorithmFactoryFactory raoAlgoFactoryFactory(*this,lc);
std::unique_ptr<RAOAlgorithmFactory> raoAlgoFactory = raoAlgoFactoryFactory.createAlgorithmFactory();
std::unique_ptr<RAOAlgorithm> raoAlgo;
......@@ -127,7 +129,9 @@ std::vector<uint64_t> RAOManager::queryRAO(const std::vector<std::unique_ptr<cta
}
cta::log::ScopedParamContainer spc(lc);
spc.add("executedRAOAlgorithm",raoAlgo->getName());
raoAlgo->getRAOTimings().addToLog(spc);
cta::log::TimingList raoTimingList = raoAlgo->getRAOTimings();
raoTimingList.insertAndReset("totalTime",totalTimer);
raoTimingList.addToLog(spc);
lc.log(cta::log::INFO, "In RAOManager::queryRAO(), successfully performed RAO.");
return ret;
}
......
......@@ -29,7 +29,7 @@ std::vector<uint64_t> RandomRAOAlgorithm::performRAO(const std::vector<std::uniq
cta::utils::Timer totalTimer;
std::iota(raoIndices.begin(),raoIndices.end(),0);
std::random_shuffle(raoIndices.begin(), raoIndices.end());
m_raoTimings.insertAndReset("totalTime",totalTimer);
m_raoTimings.insertAndReset("RAOAlgorithmTime",totalTimer);
return raoIndices;
}
......
......@@ -40,7 +40,7 @@ std::vector<uint64_t> SLTFRAOAlgorithm::performRAO(const std::vector<std::unique
//Perform a Short Locate Time First algorithm on the files
ret = performSLTF(files);
m_raoTimings.insertAndReset("performSLTFTime",t);
m_raoTimings.insertAndReset("totalTime",totalTimer);
m_raoTimings.insertAndReset("RAOAlgorithmTime",totalTimer);
return ret;
}
......
Supports Markdown
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