Commit 482f44eb authored by Victor Kotlyar's avatar Victor Kotlyar
Browse files

Deleted castor::utils::Timer

parent aa629531
......@@ -35,7 +35,7 @@
#include "castor/tape/tapeserver/daemon/DriveConfig.hpp"
#include "castor/tape/tapeserver/daemon/ProcessForkerProxy.hpp"
#include "castor/tape/tapeserver/system/Wrapper.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
#include <iostream>
#include <memory>
......@@ -362,7 +362,7 @@ private:
* Timer used to decide when to check if another transfer session needs to
* be launched.
*/
castor::utils::Timer m_launchTransferSessionTimer;
cta::utils::Timer m_launchTransferSessionTimer;
/**
* Checks that there is a tape session currently associated with the
......
......@@ -171,7 +171,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
// We are now ready to put everything in motion. First step is to check
// we get any concrete job to be done from the client (via the task injector)
castor::utils::Timer timer;
cta::utils::Timer timer;
if (rti.synchronousInjection()) { //adapt the recall task injector (starting from synchronousInjection)
// We got something to recall. Time to start the machinery
trst.setWaitForInstructionsTime(timer.secs());
......@@ -260,7 +260,7 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
drtp.setTaskInjector(&mti);
twst.setTaskInjector(&mti);
mrp.setWatchdog(mwd);
castor::utils::Timer timer;
cta::utils::Timer timer;
if (mti.synchronousInjection()) {
const uint64_t firstFseqFromClient = mti.firstFseqToWrite();
......
......@@ -23,7 +23,7 @@
#include "castor/log/LogContext.hpp"
#include "castor/tape/tapeserver/daemon/DiskReadTask.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
namespace castor {
namespace tape {
......@@ -51,8 +51,8 @@ void DiskReadTask::execute(log::LogContext& lc, diskFile::DiskFileFactory & file
using log::LogContext;
using log::Param;
castor::utils::Timer localTime;
castor::utils::Timer totalTime(localTime);
cta::utils::Timer localTime;
cta::utils::Timer totalTime(localTime);
size_t blockId=0;
size_t migratingFileSize=m_archiveJob->archiveFile.fileSize;
MemBlock* mb=NULL;
......@@ -79,7 +79,7 @@ void DiskReadTask::execute(log::LogContext& lc, diskFile::DiskFileFactory & file
}
currentErrorToCount = "";
m_stats.openingTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.openingTime+=localTime.secs(cta::utils::Timer::resetCounter);
LogContext::ScopedParam sp(lc, Param("fileId",m_archiveJob->archiveFile.archiveFileID));
lc.log(LOG_INFO,"Opened disk file for read");
......@@ -89,7 +89,7 @@ void DiskReadTask::execute(log::LogContext& lc, diskFile::DiskFileFactory & file
checkMigrationFailing();
mb = m_nextTask.getFreeBlock();
m_stats.waitFreeMemoryTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.waitFreeMemoryTime+=localTime.secs(cta::utils::Timer::resetCounter);
//set metadata and read the data
mb->m_fileid = m_archiveJob->archiveFile.archiveFileID;
......@@ -97,7 +97,7 @@ void DiskReadTask::execute(log::LogContext& lc, diskFile::DiskFileFactory & file
currentErrorToCount = "Error_diskRead";
migratingFileSize -= mb->m_payload.read(*sourceFile);
m_stats.readWriteTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.readWriteTime+=localTime.secs(cta::utils::Timer::resetCounter);
m_stats.dataVolume += mb->m_payload.size();
......@@ -121,7 +121,7 @@ void DiskReadTask::execute(log::LogContext& lc, diskFile::DiskFileFactory & file
throw cta::exception::Exception(erroMsg);
}
currentErrorToCount = "";
m_stats.checkingErrorTime += localTime.secs(castor::utils::Timer::resetCounter);
m_stats.checkingErrorTime += localTime.secs(cta::utils::Timer::resetCounter);
// We are done with the block, push it to the write task
m_nextTask.pushDataBlock(mb);
......
......@@ -159,12 +159,12 @@ void DiskReadThreadPool::DiskReadWorkerThread::run() {
m_lc.log(LOG_DEBUG, "Starting DiskReadWorkerThread");
std::unique_ptr<DiskReadTask> task;
castor::utils::Timer localTime;
castor::utils::Timer totalTime;
cta::utils::Timer localTime;
cta::utils::Timer totalTime;
while(1) {
task.reset( m_parent.popAndRequestMore(m_lc));
m_threadStat.waitInstructionsTime += localTime.secs(castor::utils::Timer::resetCounter);
m_threadStat.waitInstructionsTime += localTime.secs(cta::utils::Timer::resetCounter);
if (NULL!=task.get()) {
task->execute(m_lc, m_parent.m_diskFileFactory,m_parent.m_watchdog);
m_threadStat += task->getTaskStats();
......
......@@ -30,7 +30,7 @@
#include "common/threading/Threading.hpp"
#include "common/threading/AtomicCounter.hpp"
#include "castor/log/LogContext.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
#include <vector>
#include <stdint.h>
......@@ -137,7 +137,7 @@ private:
/**
* Measure the thread pool's lifetime
*/
castor::utils::Timer m_totalTime;
cta::utils::Timer m_totalTime;
/**
* A disk file factory, that will create the proper type of file access class,
......
......@@ -25,7 +25,7 @@
#include "castor/tape/tapeserver/daemon/DiskWriteTask.hpp"
#include "castor/tape/tapeserver/daemon/AutoReleaseBlock.hpp"
#include "castor/tape/tapeserver/daemon/MemBlock.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
namespace castor {
namespace tape {
......@@ -47,9 +47,9 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
diskFile::DiskFileFactory & fileFactory, RecallWatchDog & watchdog) {
using log::LogContext;
using log::Param;
castor::utils::Timer localTime;
castor::utils::Timer totalTime(localTime);
castor::utils::Timer transferTime(localTime);
cta::utils::Timer localTime;
cta::utils::Timer totalTime(localTime);
cta::utils::Timer transferTime(localTime);
log::ScopedParamContainer URLcontext(lc);
URLcontext.add("archiveFileID",m_retrieveJob->retrieveRequest.archiveFileID)
.add("dstURL", m_retrieveJob->retrieveRequest.dstURL)
......@@ -69,7 +69,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
unsigned long checksum = Payload::zeroAdler32();
while(1) {
if(MemBlock* const mb = m_fifo.pop()) {
m_stats.waitDataTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.waitDataTime+=localTime.secs(cta::utils::Timer::resetCounter);
AutoReleaseBlock<RecallMemoryManager> releaser(mb,m_memManager);
if(mb->isCanceled()) {
// If the tape side got canceled, we report nothing and count
......@@ -80,7 +80,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
//will throw (thus exiting the loop) if something is wrong
checkErrors(mb,blockId,lc);
m_stats.checkingErrorTime += localTime.secs(castor::utils::Timer::resetCounter);
m_stats.checkingErrorTime += localTime.secs(cta::utils::Timer::resetCounter);
// If we got that far on the first pass, it's now good enough to open
// the disk file for writing...
if (!writeFile.get()) {
......@@ -91,17 +91,17 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
writeFile.reset(fileFactory.createWriteFile(m_retrieveJob->retrieveRequest.dstURL));
URLcontext.add("actualURL", writeFile->URL());
lc.log(LOG_INFO, "Opened disk file for writing");
m_stats.openingTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.openingTime+=localTime.secs(cta::utils::Timer::resetCounter);
}
// Write the data.
currentErrorToCount = "Error_diskWrite";
m_stats.dataVolume+=mb->m_payload.size();
mb->m_payload.write(*writeFile);
m_stats.readWriteTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.readWriteTime+=localTime.secs(cta::utils::Timer::resetCounter);
checksum = mb->m_payload.adler32(checksum);
m_stats.checksumingTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.checksumingTime+=localTime.secs(cta::utils::Timer::resetCounter);
currentErrorToCount = "";
blockId++;
......@@ -112,7 +112,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
//silent data loss
currentErrorToCount = "Error_diskCloseAfterWrite";
writeFile->close();
m_stats.closingTime +=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.closingTime +=localTime.secs(cta::utils::Timer::resetCounter);
m_stats.filesCount++;
break;
currentErrorToCount = "";
......@@ -127,7 +127,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
m_retrieveJob->transferredChecksumValue = cs.str();
}
reporter.reportCompletedJob(std::move(m_retrieveJob));
m_stats.waitReportingTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.waitReportingTime+=localTime.secs(cta::utils::Timer::resetCounter);
m_stats.transferTime = transferTime.secs();
m_stats.totalTime = totalTime.secs();
......@@ -152,7 +152,7 @@ bool DiskWriteTask::execute(RecallReportPacker& reporter,log::LogContext& lc,
watchdog.addToErrorCount(currentErrorToCount);
}
m_stats.waitReportingTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_stats.waitReportingTime+=localTime.secs(cta::utils::Timer::resetCounter);
log::ScopedParamContainer params(lc);
params.add("errorMessage", e.getMessageValue());
logWithStat(LOG_ERR, "File writing to disk failed.", lc);
......
......@@ -23,7 +23,7 @@
#include "castor/tape/tapeserver/daemon/DiskWriteThreadPool.hpp"
#include "castor/common/CastorConfiguration.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
#include "castor/log/LogContext.hpp"
#include <memory>
......@@ -153,12 +153,12 @@ void DiskWriteThreadPool::DiskWriteWorkerThread::run() {
m_lc.log(LOG_INFO, "Starting DiskWriteWorkerThread");
std::unique_ptr<DiskWriteTask> task;
castor::utils::Timer localTime;
castor::utils::Timer totalTime(localTime);
cta::utils::Timer localTime;
cta::utils::Timer totalTime(localTime);
while(1) {
task.reset(m_parentThreadPool.m_tasks.pop());
m_threadStat.waitInstructionsTime+=localTime.secs(castor::utils::Timer::resetCounter);
m_threadStat.waitInstructionsTime+=localTime.secs(cta::utils::Timer::resetCounter);
if (NULL!=task.get()) {
if(false==task->execute(m_parentThreadPool.m_reporter,m_lc,
m_parentThreadPool.m_diskFileFactory, m_parentThreadPool.m_watchdog)) {
......
......@@ -33,7 +33,7 @@
#include "castor/tape/tapeserver/daemon/DiskWriteTask.hpp"
#include "castor/tape/tapeserver/daemon/DiskStats.hpp"
#include "castor/tape/tapeserver/daemon/TaskWatchDog.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
#include <vector>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
......@@ -189,7 +189,7 @@ private:
/**
* Measure the thread pool's lifetime
*/
castor::utils::Timer m_totalTime;
cta::utils::Timer m_totalTime;
/** Reference to the report packer where tasks report the result of their
* individual files and the end of session (for the last thread) */
......
......@@ -54,7 +54,7 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::TapeCleaning::~TapeClean
m_this.m_taskInjector->finish();
//then we log/notify
m_this.m_logContext.log(LOG_DEBUG, "Starting session cleanup. Signalled end of session to task injector.");
m_this.m_stats.waitReportingTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_stats.waitReportingTime += m_timer.secs(cta::utils::Timer::resetCounter);
// Log (safely, exception-wise) the tape alerts (if any) at the end of the session
try { m_this.logTapeAlerts(); } catch (...) {}
// This out-of-try-catch variables allows us to record the stage of the
......@@ -83,7 +83,7 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::TapeCleaning::~TapeClean
} else {
m_this.m_logContext.log(LOG_INFO, "TapeReadSingleThread: Tape NOT unloaded (manual mode)");
}
m_this.m_stats.unloadTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_stats.unloadTime += m_timer.secs(cta::utils::Timer::resetCounter);
// And return the tape to the library
// In case of manual mode, this will be filtered by the rmc daemon
// (which will do nothing)
......@@ -92,11 +92,11 @@ castor::tape::tapeserver::daemon::TapeReadSingleThread::TapeCleaning::~TapeClean
m_this.m_mc.dismountTape(m_this.m_volInfo.vid, m_this.m_drive.config.getLibrarySlot());
m_this.m_drive.disableLogicalBlockProtection();
m_this.m_rrp.reportDriveStatus(cta::common::DriveStatus::Up);
m_this.m_stats.unmountTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_stats.unmountTime += m_timer.secs(cta::utils::Timer::resetCounter);
m_this.m_logContext.log(LOG_INFO, mediachanger::TAPE_LIBRARY_TYPE_MANUAL != m_this.m_drive.config.getLibrarySlot().getLibraryType() ?
"TapeReadSingleThread : tape unmounted":"TapeReadSingleThread : tape NOT unmounted (manual mode)");
m_this.m_initialProcess.reportTapeUnmountedForRetrieve();
m_this.m_stats.waitReportingTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_stats.waitReportingTime += m_timer.secs(cta::utils::Timer::resetCounter);
} catch(const cta::exception::Exception& ex){
// Something failed during the cleaning
m_this.m_hardwareStatus = Session::MARK_DRIVE_AS_DOWN;
......@@ -181,7 +181,7 @@ const char *castor::tape::tapeserver::daemon::TapeReadSingleThread::
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
m_logContext.pushOrReplace(log::Param("thread", "TapeRead"));
castor::utils::Timer timer, totalTimer;
cta::utils::Timer timer, totalTimer;
std::string currentErrorToCount = "Error_setCapabilities";
try{
// Set capabilities allowing rawio (and hence arbitrary SCSI commands)
......@@ -211,7 +211,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
waitForDrive();
currentErrorToCount = "Error_checkingTapeAlert";
logTapeAlerts();
m_stats.mountTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.mountTime += timer.secs(cta::utils::Timer::resetCounter);
{
castor::log::ScopedParamContainer scoped(m_logContext);
scoped.add("mountTime", m_stats.mountTime);
......@@ -222,7 +222,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
std::unique_ptr<castor::tape::tapeFile::ReadSession> rs(openReadSession());
// From now on, the tasks will identify problems when executed.
currentErrorToCount = "";
m_stats.positionTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.positionTime += timer.secs(cta::utils::Timer::resetCounter);
//and then report
{
castor::log::ScopedParamContainer scoped(m_logContext);
......@@ -249,7 +249,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
}
m_initialProcess.reportState(cta::tape::session::SessionState::Running,
cta::tape::session::SessionType::Retrieve);
m_stats.waitReportingTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.waitReportingTime += timer.secs(cta::utils::Timer::resetCounter);
// Then we will loop on the tasks as they get from
// the task injector
std::unique_ptr<TapeReadTask> task;
......@@ -257,7 +257,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
while(true) {
//get a task
task.reset(popAndRequestMoreJobs());
m_stats.waitInstructionsTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.waitInstructionsTime += timer.secs(cta::utils::Timer::resetCounter);
// If we reached the end
if (NULL==task.get()) {
m_logContext.log(LOG_DEBUG, "No more files to read from tape");
......
......@@ -34,7 +34,7 @@
#include "castor/tape/tapeserver/daemon/TapeServerReporter.hpp"
#include "castor/tape/tapeserver/daemon/TaskWatchDog.hpp"
#include "castor/tape/tapeserver/daemon/VolumeInfo.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
#include <iostream>
#include <memory>
......@@ -89,9 +89,9 @@ private:
class TapeCleaning{
TapeReadSingleThread& m_this;
// As we are living in the single thread of tape, we can borrow the timer
castor::utils::Timer & m_timer;
cta::utils::Timer & m_timer;
public:
TapeCleaning(TapeReadSingleThread& parent, castor::utils::Timer & timer):
TapeCleaning(TapeReadSingleThread& parent, cta::utils::Timer & timer):
m_this(parent), m_timer(timer){}
~TapeCleaning();
};
......
......@@ -30,7 +30,7 @@
#include "castor/tape/tapeserver/daemon/AutoReleaseBlock.hpp"
#include "castor/tape/tapeserver/daemon/TaskWatchDog.hpp"
#include "castor/tape/tapeserver/daemon/TapeSessionStats.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
#include "common/exception/Exception.hpp"
namespace castor {
......@@ -62,7 +62,7 @@ public:
*/
void execute(castor::tape::tapeFile::ReadSession & rs,
castor::log::LogContext & lc,RecallWatchDog& watchdog,
TapeSessionStats & stats, castor::utils::Timer & timer) {
TapeSessionStats & stats, cta::utils::Timer & timer) {
using castor::log::Param;
......@@ -77,8 +77,8 @@ public:
// stats to the session's.
TapeSessionStats localStats;
std::string LBPMode;
castor::utils::Timer localTime;
castor::utils::Timer totalTime(localTime);
cta::utils::Timer localTime;
cta::utils::Timer totalTime(localTime);
// Read the file and transmit it
bool stillReading = true;
......@@ -100,14 +100,14 @@ public:
localStats.headerVolume += TapeSessionStats::headerVolumePerFile;
lc.log(LOG_INFO, "Successfully positioned for reading");
localStats.positionTime += timer.secs(castor::utils::Timer::resetCounter);
localStats.positionTime += timer.secs(cta::utils::Timer::resetCounter);
watchdog.notifyBeginNewJob(m_retrieveJob->archiveFile.archiveFileID, m_retrieveJob->selectedTapeFile().fSeq);
localStats.waitReportingTime += timer.secs(castor::utils::Timer::resetCounter);
localStats.waitReportingTime += timer.secs(cta::utils::Timer::resetCounter);
currentErrorToCount = "Error_tapeReadData";
while (stillReading) {
// Get a memory block and add information to its metadata
mb=m_mm.getFreeBlock();
localStats.waitFreeMemoryTime += timer.secs(castor::utils::Timer::resetCounter);
localStats.waitFreeMemoryTime += timer.secs(cta::utils::Timer::resetCounter);
mb->m_fSeq = m_retrieveJob->selectedTapeFile().fSeq;
mb->m_fileBlock = fileBlock++;
......@@ -126,13 +126,13 @@ public:
// append() signaled the end of the file.
stillReading = false;
}
localStats.readWriteTime += timer.secs(castor::utils::Timer::resetCounter);
localStats.readWriteTime += timer.secs(cta::utils::Timer::resetCounter);
localStats.dataVolume += mb->m_payload.size();
// Pass the block to the disk write task
m_fifo.pushDataBlock(mb);
mb=NULL;
watchdog.notify();
localStats.waitReportingTime += timer.secs(castor::utils::Timer::resetCounter);
localStats.waitReportingTime += timer.secs(cta::utils::Timer::resetCounter);
} //end of while(stillReading)
// we have to signal the end of the tape read to the disk write task.
m_fifo.pushDataBlock(NULL);
......
......@@ -37,7 +37,7 @@
#include "castor/tape/tapeserver/daemon/TapeSessionStats.hpp"
#include "castor/tape/tapeserver/daemon/VolumeInfo.hpp"
#include "castor/tape/tapeserver/drive/DriveInterface.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
namespace castor {
namespace tape {
......@@ -115,7 +115,7 @@ protected:
scoped.add("TPVID",m_volInfo.vid)
.add("drive_Slot",m_drive.config.getLibrarySlot().str());
try {
castor::utils::Timer timer;
cta::utils::Timer timer;
m_mc.mountTapeReadOnly(m_volInfo.vid, m_drive.config.getLibrarySlot());
const std::string modeAsString = "R";
scoped.add("MCMountTime",timer.secs()).add("mode",modeAsString);
......@@ -140,7 +140,7 @@ protected:
scoped.add("TPVID",m_volInfo.vid)
.add("drive_Slot",m_drive.config.getLibrarySlot().str());
try {
castor::utils::Timer timer;
cta::utils::Timer timer;
m_mc.mountTapeReadWrite(m_volInfo.vid, m_drive.config.getLibrarySlot());
const std::string modeAsString = "RW";
scoped.add("MCMountTime",timer.secs()).add("mode",modeAsString);
......@@ -163,7 +163,7 @@ protected:
*/
void waitForDrive(){
try{
castor::utils::Timer timer;
cta::utils::Timer timer;
// wait 600 drive is ready
m_drive.waitUntilReady(600);
log::LogContext::ScopedParam sp0(m_logContext, log::Param("loadTime", timer.secs()));
......
......@@ -93,10 +93,10 @@ castor::tape::tapeserver::daemon::TapeWriteSingleThread::openWriteSession() {
//------------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::TapeWriteSingleThread::
tapeFlush(const std::string& message,uint64_t bytes,uint64_t files,
castor::utils::Timer & timer)
cta::utils::Timer & timer)
{
m_drive.flush();
double flushTime = timer.secs(castor::utils::Timer::resetCounter);
double flushTime = timer.secs(cta::utils::Timer::resetCounter);
log::ScopedParamContainer params(m_logContext);
params.add("files", files)
.add("bytes", bytes)
......@@ -141,7 +141,7 @@ const char *castor::tape::tapeserver::daemon::TapeWriteSingleThread::
void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
castor::log::ScopedParamContainer threadGlobalParams(m_logContext);
threadGlobalParams.add("thread", "TapeWrite");
castor::utils::Timer timer, totalTimer;
cta::utils::Timer timer, totalTimer;
// This out-of-try-catch variables allows us to record the stage of the
// process we're in, and to count the error if it occurs.
// We will not record errors for an empty string. This will allow us to
......@@ -186,7 +186,7 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
currentErrorToCount = "Error_tapeNotWriteable";
isTapeWritable();
m_stats.mountTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.mountTime += timer.secs(cta::utils::Timer::resetCounter);
{
castor::log::ScopedParamContainer scoped(m_logContext);
scoped.add("mountTime", m_stats.mountTime);
......@@ -195,7 +195,7 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
currentErrorToCount = "Error_tapePositionForWrite";
// Then we have to initialize the tape write session
std::unique_ptr<castor::tape::tapeFile::WriteSession> writeSession(openWriteSession());
m_stats.positionTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.positionTime += timer.secs(cta::utils::Timer::resetCounter);
{
castor::log::ScopedParamContainer scoped(m_logContext);
scoped.add("positionTime", m_stats.positionTime);
......@@ -227,7 +227,7 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
cta::tape::session::SessionType::Archive);
uint64_t bytes=0;
uint64_t files=0;
m_stats.waitReportingTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.waitReportingTime += timer.secs(cta::utils::Timer::resetCounter);
// Tasks handle their error logging themselves.
currentErrorToCount = "";
std::unique_ptr<TapeWriteTask> task;
......@@ -235,12 +235,12 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
while(1) {
//get a task
task.reset(m_tasks.pop());
m_stats.waitInstructionsTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.waitInstructionsTime += timer.secs(cta::utils::Timer::resetCounter);
//if is the end
if(NULL==task.get()) {
//we flush without asking
tapeFlush("No more data to write on tape, unconditional flushing to the client",bytes,files,timer);
m_stats.flushTime += timer.secs(castor::utils::Timer::resetCounter);
m_stats.flushTime += timer.secs(cta::utils::Timer::resetCounter);
//end of session + log
m_reportPacker.reportEndOfSession();
log::LogContext::ScopedParam sp0(m_logContext, log::Param("tapeThreadDuration", totalTimer.secs()));
......
......@@ -34,7 +34,7 @@
#include "common/threading/BlockingQueue.hpp"
#include "common/threading/Threading.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include "castor/utils/Timer.hpp"
#include "common/Timer.hpp"
#include <iostream>
#include <stdio.h>
......@@ -99,9 +99,9 @@ private:
class TapeCleaning{
TapeWriteSingleThread& m_this;
// As we are living in the single thread of tape, we can borrow the timer
castor::utils::Timer & m_timer;
cta::utils::Timer & m_timer;
public:
TapeCleaning(TapeWriteSingleThread& parent, castor::utils::Timer & timer):
TapeCleaning(TapeWriteSingleThread& parent, cta::utils::Timer & timer):
m_this(parent), m_timer(timer) {}
~TapeCleaning(){
m_this.m_reportPacker.reportDriveStatus(cta::common::DriveStatus::CleaningUp);
......@@ -133,7 +133,7 @@ private:
} else {
m_this.m_logContext.log(LOG_INFO, "TapeWriteSingleThread: Tape NOT unloaded (manual mode)");
}
m_this.m_stats.unloadTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_stats.unloadTime += m_timer.secs(cta::utils::Timer::resetCounter);
// And return the tape to the library
// In case of manual mode, this will be filtered by the rmc daemon
// (which will do nothing)
......@@ -142,12 +142,12 @@ private:
m_this.m_mc.dismountTape(m_this.m_volInfo.vid, m_this.m_drive.config.getLibrarySlot());
m_this.m_drive.disableLogicalBlockProtection();
m_this.m_reportPacker.reportDriveStatus(cta::common::DriveStatus::Up);
m_this.m_stats.unmountTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_stats.unmountTime += m_timer.secs(cta::utils::Timer::resetCounter);
m_this.m_logContext.log(LOG_INFO, mediachanger::TAPE_LIBRARY_TYPE_MANUAL != m_this.m_drive.config.getLibrarySlot().getLibraryType() ?
"TapeWriteSingleThread : tape unmounted":"TapeWriteSingleThread : tape NOT unmounted (manual mode)");
m_this.m_initialProcess.reportState(cta::tape::session::SessionState::Shutdown,
cta::tape::session::SessionType::Archive);
m_this.m_stats.waitReportingTime += m_timer.secs(castor::utils::Timer::resetCounter);
m_this.m_stats.waitReportingTime += m_timer.secs(cta::utils::Timer::resetCounter);
}
catch(const cta::exception::Exception& ex){
// Notify something failed during the cleaning
......@@ -207,7 +207,7 @@ private:
* (also for logging)
*/
void tapeFlush(const std::string& message,uint64_t bytes,uint64_t files,
castor::utils::Timer & timer);
cta::utils::Timer & timer);
virtual void run() ;
......
......@@ -64,7 +64,7 @@ namespace daemon {
//------------------------------------------------------------------------------
void TapeWriteTask::execute(castor::tape::tapeFile::WriteSession & session,
MigrationReportPacker & reportPacker, MigrationWatchDog & watchdog,
castor::log::LogContext& lc, castor::utils::Timer & timer) {
castor::log::LogContext& lc, cta::utils::Timer & timer) {
using castor::log::LogContext;
using castor::log::Param;
using castor::log::ScopedParamContainer;
......@@ -77,7 +77,7 @@ namespace daemon {
// We will clock the stats for the file itself, and eventually add those