Commit 713f2ed6 authored by David COME's avatar David COME
Browse files

Added a few logs in DiskReadThreadPool ans fixed some log levels into...

Added a few logs in DiskReadThreadPool ans fixed some log levels into MemManager MigrationTaskInjector and
RecallMemoryManager
parent d02b2c0e
...@@ -37,6 +37,8 @@ namespace daemon { ...@@ -37,6 +37,8 @@ namespace daemon {
for(int i=0; i<nbThread; i++) { for(int i=0; i<nbThread; i++) {
DiskReadWorkerThread * thr = new DiskReadWorkerThread(*this); DiskReadWorkerThread * thr = new DiskReadWorkerThread(*this);
m_threads.push_back(thr); m_threads.push_back(thr);
m_lc.pushOrReplace(log::Param("threadID",i));
m_lc.log(LOG_INFO, "DiskReadWorkerThread created");
} }
} }
DiskReadThreadPool::~DiskReadThreadPool() { DiskReadThreadPool::~DiskReadThreadPool() {
...@@ -44,12 +46,14 @@ namespace daemon { ...@@ -44,12 +46,14 @@ namespace daemon {
delete m_threads.back(); delete m_threads.back();
m_threads.pop_back(); m_threads.pop_back();
} }
m_lc.log(LOG_INFO, "All the DiskReadWorkerThreads have been destroyed");
} }
void DiskReadThreadPool::startThreads() { void DiskReadThreadPool::startThreads() {
for (std::vector<DiskReadWorkerThread *>::iterator i=m_threads.begin(); for (std::vector<DiskReadWorkerThread *>::iterator i=m_threads.begin();
i != m_threads.end(); i++) { i != m_threads.end(); i++) {
(*i)->startThreads(); (*i)->startThreads();
} }
m_lc.log(LOG_INFO, "All the DiskReadWorkerThreads are started");
} }
void DiskReadThreadPool::waitThreads() { void DiskReadThreadPool::waitThreads() {
for (std::vector<DiskReadWorkerThread *>::iterator i=m_threads.begin(); for (std::vector<DiskReadWorkerThread *>::iterator i=m_threads.begin();
...@@ -59,6 +63,7 @@ namespace daemon { ...@@ -59,6 +63,7 @@ namespace daemon {
} }
void DiskReadThreadPool::push(DiskReadTaskInterface *t) { void DiskReadThreadPool::push(DiskReadTaskInterface *t) {
m_tasks.push(t); m_tasks.push(t);
m_lc.log(LOG_INFO, "Push a task into the DiskReadThreadPool");
} }
void DiskReadThreadPool::finish() { void DiskReadThreadPool::finish() {
/* Insert one endOfSession per thread */ /* Insert one endOfSession per thread */
...@@ -69,17 +74,21 @@ namespace daemon { ...@@ -69,17 +74,21 @@ namespace daemon {
DiskReadTaskInterface* DiskReadThreadPool::popAndRequestMore(){ DiskReadTaskInterface* DiskReadThreadPool::popAndRequestMore(){
castor::tape::threading::BlockingQueue<DiskReadTaskInterface*>::valueRemainingPair castor::tape::threading::BlockingQueue<DiskReadTaskInterface*>::valueRemainingPair
vrp = m_tasks.popGetSize(); vrp = m_tasks.popGetSize();
log::LogContext::ScopedParam sp(m_lc, log::Param("m_maxFilesReq", m_maxFilesReq));
log::LogContext::ScopedParam sp0(m_lc, log::Param("m_maxBytesReq", m_maxBytesReq));
if(0==vrp.remaining){ if(0==vrp.remaining){
m_injector->requestInjection(m_maxFilesReq, m_maxBytesReq,true); m_injector->requestInjection(m_maxFilesReq, m_maxBytesReq,true);
m_lc.log(LOG_DEBUG, "Requested injection from MigrationTaskInjector (with last call)");
}else if(vrp.remaining + 1 == m_maxFilesReq/2){ }else if(vrp.remaining + 1 == m_maxFilesReq/2){
m_injector->requestInjection(m_maxFilesReq, m_maxBytesReq,false); m_injector->requestInjection(m_maxFilesReq, m_maxBytesReq,false);
m_lc.log(LOG_DEBUG, "Requested injection from MigrationTaskInjector (without last call)");
} }
return vrp.value; return vrp.value;
} }
void DiskReadThreadPool::DiskReadWorkerThread::run() { void DiskReadThreadPool::DiskReadWorkerThread::run() {
m_lc.pushOrReplace(log::Param("thread", "DiskRead")); m_lc.pushOrReplace(log::Param("threadID",m_threadID));
m_lc.log(LOG_DEBUG, "Starting DiskReadWorkerThread"); m_lc.log(LOG_DEBUG, "DiskReadWorkerThread Running");
std::auto_ptr<DiskReadTaskInterface> task; std::auto_ptr<DiskReadTaskInterface> task;
while(1) { while(1) {
task.reset( m_parent.popAndRequestMore()); task.reset( m_parent.popAndRequestMore());
...@@ -94,9 +103,9 @@ namespace daemon { ...@@ -94,9 +103,9 @@ namespace daemon {
// will hence be no more requests for more. (last thread turns off the light) // will hence be no more requests for more. (last thread turns off the light)
if (0 == --m_parent.m_nbActiveThread) { if (0 == --m_parent.m_nbActiveThread) {
m_parent.m_injector->finish(); m_parent.m_injector->finish();
m_lc.log(LOG_DEBUG, "Signaled to task injector the end of disk read threads"); m_lc.log(LOG_INFO, "Signaled to task injector the end of disk read threads");
} }
m_lc.log(LOG_DEBUG, "Finishing of DiskReadWorkerThread"); m_lc.log(LOG_INFO, "Finishing of DiskReadWorkerThread");
} }
}}}} }}}}
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
m_totalMemoryAllocated+=blockSize; m_totalMemoryAllocated+=blockSize;
m_lc.pushOrReplace(log::Param("blockId",i)); m_lc.pushOrReplace(log::Param("blockId",i));
m_lc.log(LOG_INFO,"MigrationMemoryManager Created a block"); m_lc.log(LOG_DEBUG,"MigrationMemoryManager Created a block");
} }
m_lc.log(LOG_INFO,"MigrationMemoryManager: all blocks have been created"); m_lc.log(LOG_INFO,"MigrationMemoryManager: all blocks have been created");
} }
......
...@@ -132,7 +132,7 @@ namespace daemon { ...@@ -132,7 +132,7 @@ namespace daemon {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void MigrationTaskInjector::WorkerThread::run(){ void MigrationTaskInjector::WorkerThread::run(){
m_parent.m_lc.pushOrReplace(Param("thread", "MigrationTaskInjector")); m_parent.m_lc.pushOrReplace(Param("thread", "MigrationTaskInjector"));
m_parent.m_lc.log(LOG_DEBUG, "Starting MigrationTaskInjector thread"); m_parent.m_lc.log(LOG_INFO, "Starting MigrationTaskInjector thread");
try{ try{
while(1){ while(1){
if(m_parent.m_errorFlag){ if(m_parent.m_errorFlag){
...@@ -171,7 +171,7 @@ namespace daemon { ...@@ -171,7 +171,7 @@ namespace daemon {
} }
} // end of while(1) } // end of while(1)
//------------- //-------------
m_parent.m_lc.log(LOG_DEBUG, "Finishing MigrationTaskInjector thread"); m_parent.m_lc.log(LOG_INFO, "Finishing MigrationTaskInjector thread");
/* We want to finish at the first lastCall we encounter. /* We want to finish at the first lastCall we encounter.
* But even after sending finish() to m_diskWriter and to m_tapeReader, * But even after sending finish() to m_diskWriter and to m_tapeReader,
* m_diskWriter might still want some more task (the threshold could be crossed), * m_diskWriter might still want some more task (the threshold could be crossed),
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
m_freeBlocks.push(new MemBlock(i, blockSize)); m_freeBlocks.push(new MemBlock(i, blockSize));
m_lc.pushOrReplace(log::Param("blockId",i)); m_lc.pushOrReplace(log::Param("blockId",i));
m_lc.log(LOG_INFO,"RecallMemoryManager created a block"); m_lc.log(LOG_DEBUG,"RecallMemoryManager created a block");
} }
m_lc.log(LOG_INFO,"RecallMemoryManager: all blocks have been created"); m_lc.log(LOG_INFO,"RecallMemoryManager: all blocks have been created");
} }
......
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