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