Commit fc3527a5 authored by Eric Cano's avatar Eric Cano
Browse files

Removed leftovers of special case snprintf call for double, now that snprintf...

Removed leftovers of special case snprintf call for double, now that snprintf is the default for doubles.
parent bfdb550c
......@@ -159,12 +159,6 @@ class ScopedParamContainer{
m_names.push_back(s);
return *this;
}
ScopedParamContainer& addSnprintfDouble(const std::string& s,double t){
m_context.pushOrReplace(ParamDoubleSnprintf(s,t));
m_names.push_back(s);
return *this;
}
private:
LogContext & m_context;
......
......@@ -38,15 +38,3 @@ const std::string &castor::log::Param::getValue() const throw() {
return m_value;
}
//------------------------------------------------------------------------------
// ParamDoubleSnprintf constructor
//------------------------------------------------------------------------------
castor::log::ParamDoubleSnprintf::ParamDoubleSnprintf
(const std::string& name, const double value):
castor::log::Param(name, "") {
char buf[100];
std::snprintf(buf, sizeof(buf), "%f", value);
// Just in case we overflow
buf[sizeof(buf)-1]='\0';
m_value = buf;
}
......@@ -166,20 +166,20 @@ void DiskReadTask::circulateAllBlocks(size_t fromBlockId, MemBlock * mb){
//------------------------------------------------------------------------------
void DiskReadTask::logWithStat(int level,const std::string& msg,log::LogContext& lc){
log::ScopedParamContainer params(lc);
params.addSnprintfDouble("readWriteTime", m_stats.readWriteTime)
.addSnprintfDouble("checksumingTime",m_stats.checksumingTime)
.addSnprintfDouble("waitDataTime",m_stats.waitDataTime)
.addSnprintfDouble("waitReportingTime",m_stats.waitReportingTime)
.addSnprintfDouble("checkingErrorTime",m_stats.checkingErrorTime)
.addSnprintfDouble("openingTime",m_stats.openingTime)
.addSnprintfDouble("transferTime", m_stats.transferTime)
.addSnprintfDouble("totalTime", m_stats.totalTime)
params.add("readWriteTime", m_stats.readWriteTime)
.add("checksumingTime",m_stats.checksumingTime)
.add("waitDataTime",m_stats.waitDataTime)
.add("waitReportingTime",m_stats.waitReportingTime)
.add("checkingErrorTime",m_stats.checkingErrorTime)
.add("openingTime",m_stats.openingTime)
.add("transferTime", m_stats.transferTime)
.add("totalTime", m_stats.totalTime)
.add("dataVolume", m_stats.dataVolume)
.addSnprintfDouble("globalPayloadTransferSpeedMBps",
.add("globalPayloadTransferSpeedMBps",
m_stats.totalTime?1.0*m_stats.dataVolume/1000/1000/m_stats.totalTime:0)
.addSnprintfDouble("diskPerformanceMBps",
.add("diskPerformanceMBps",
m_stats.transferTime?1.0*m_stats.dataVolume/1000/1000/m_stats.transferTime:0)
.addSnprintfDouble("openRWCloseToTransferTimeRatio",
.add("openRWCloseToTransferTimeRatio",
m_stats.transferTime?(m_stats.openingTime+m_stats.readWriteTime+m_stats.closingTime)/m_stats.transferTime:0.0)
.add("FILEID",m_migratedFile->fileid())
.add("path",m_migratedFile->path());
......
......@@ -131,19 +131,19 @@ void DiskReadThreadPool::addThreadStats(const DiskStats& other){
void DiskReadThreadPool::logWithStat(int level, const std::string& message){
m_pooldStat.totalTime = m_totalTime.secs();
log::ScopedParamContainer params(m_lc);
params.addSnprintfDouble("poolReadWriteTime", m_pooldStat.readWriteTime)
.addSnprintfDouble("poolWaitFreeMemoryTime",m_pooldStat.waitFreeMemoryTime)
.addSnprintfDouble("poolCheckingErrorTime",m_pooldStat.checkingErrorTime)
.addSnprintfDouble("poolOpeningTime",m_pooldStat.openingTime)
.addSnprintfDouble("poolTransferTime", m_pooldStat.transferTime)
.addSnprintfDouble("poolRealTime",m_pooldStat.totalTime)
params.add("poolReadWriteTime", m_pooldStat.readWriteTime)
.add("poolWaitFreeMemoryTime",m_pooldStat.waitFreeMemoryTime)
.add("poolCheckingErrorTime",m_pooldStat.checkingErrorTime)
.add("poolOpeningTime",m_pooldStat.openingTime)
.add("poolTransferTime", m_pooldStat.transferTime)
.add("poolRealTime",m_pooldStat.totalTime)
.add("poolFileCount",m_pooldStat.filesCount)
.add("poolDataVolume", m_pooldStat.dataVolume)
.addSnprintfDouble("poolGlobalPayloadTransferSpeedMBps",
.add("poolGlobalPayloadTransferSpeedMBps",
m_pooldStat.totalTime?1.0*m_pooldStat.dataVolume/1000/1000/m_pooldStat.totalTime:0)
.addSnprintfDouble("poolAverageDiskPerformanceMBps",
.add("poolAverageDiskPerformanceMBps",
m_pooldStat.transferTime?1.0*m_pooldStat.dataVolume/1000/1000/m_pooldStat.transferTime:0.0)
.addSnprintfDouble("poolOpenRWCloseToTransferTimeRatio",
.add("poolOpenRWCloseToTransferTimeRatio",
m_pooldStat.transferTime?(m_pooldStat.openingTime+m_pooldStat.readWriteTime+m_pooldStat.closingTime)/m_pooldStat.transferTime:0.0);
m_lc.log(level,message);
}
......@@ -194,19 +194,19 @@ void DiskReadThreadPool::DiskReadWorkerThread::run() {
void DiskReadThreadPool::DiskReadWorkerThread::
logWithStat(int level, const std::string& message){
log::ScopedParamContainer params(m_lc);
params.addSnprintfDouble("threadReadWriteTime", m_threadStat.readWriteTime)
.addSnprintfDouble("threadWaitFreeMemoryTime",m_threadStat.waitFreeMemoryTime)
.addSnprintfDouble("threadCheckingErrorTime",m_threadStat.checkingErrorTime)
.addSnprintfDouble("threadOpeningTime",m_threadStat.openingTime)
.addSnprintfDouble("threadTransferTime",m_threadStat.transferTime)
.addSnprintfDouble("threadTotalTime",m_threadStat.totalTime)
params.add("threadReadWriteTime", m_threadStat.readWriteTime)
.add("threadWaitFreeMemoryTime",m_threadStat.waitFreeMemoryTime)
.add("threadCheckingErrorTime",m_threadStat.checkingErrorTime)
.add("threadOpeningTime",m_threadStat.openingTime)
.add("threadTransferTime",m_threadStat.transferTime)
.add("threadTotalTime",m_threadStat.totalTime)
.add("threadDataVolume",m_threadStat.dataVolume)
.add("threadFileCount",m_threadStat.filesCount)
.addSnprintfDouble("threadGlobalPayloadTransferSpeedMBps",
.add("threadGlobalPayloadTransferSpeedMBps",
m_threadStat.totalTime?1.0*m_threadStat.dataVolume/1000/1000/m_threadStat.totalTime:0)
.addSnprintfDouble("threadAverageDiskPerformanceMBps",
.add("threadAverageDiskPerformanceMBps",
m_threadStat.transferTime?1.0*m_threadStat.dataVolume/1000/1000/m_threadStat.transferTime:0.0)
.addSnprintfDouble("threadOpenRWCloseToTransferTimeRatio",
.add("threadOpenRWCloseToTransferTimeRatio",
m_threadStat.transferTime?(m_threadStat.openingTime+m_threadStat.readWriteTime+m_threadStat.closingTime)/m_threadStat.transferTime:0.0);
m_lc.log(level,message);
}
......
......@@ -212,21 +212,21 @@ const DiskStats DiskWriteTask::getTaskStats() const{
//------------------------------------------------------------------------------
void DiskWriteTask::logWithStat(int level,const std::string& msg,log::LogContext& lc){
log::ScopedParamContainer params(lc);
params.addSnprintfDouble("readWriteTime", m_stats.readWriteTime)
.addSnprintfDouble("checksumingTime",m_stats.checksumingTime)
.addSnprintfDouble("waitDataTime",m_stats.waitDataTime)
.addSnprintfDouble("waitReportingTime",m_stats.waitReportingTime)
.addSnprintfDouble("checkingErrorTime",m_stats.checkingErrorTime)
.addSnprintfDouble("openingTime",m_stats.openingTime)
.addSnprintfDouble("closingTime",m_stats.closingTime)
.addSnprintfDouble("transferTime", m_stats.transferTime)
.addSnprintfDouble("totalTime", m_stats.totalTime)
params.add("readWriteTime", m_stats.readWriteTime)
.add("checksumingTime",m_stats.checksumingTime)
.add("waitDataTime",m_stats.waitDataTime)
.add("waitReportingTime",m_stats.waitReportingTime)
.add("checkingErrorTime",m_stats.checkingErrorTime)
.add("openingTime",m_stats.openingTime)
.add("closingTime",m_stats.closingTime)
.add("transferTime", m_stats.transferTime)
.add("totalTime", m_stats.totalTime)
.add("dataVolume", m_stats.dataVolume)
.addSnprintfDouble("globalPayloadTransferSpeedMBps",
.add("globalPayloadTransferSpeedMBps",
m_stats.totalTime?1.0*m_stats.dataVolume/1000/1000/m_stats.totalTime:0)
.addSnprintfDouble("diskPerformanceMBps",
.add("diskPerformanceMBps",
m_stats.transferTime?1.0*m_stats.dataVolume/1000/1000/m_stats.transferTime:0)
.addSnprintfDouble("openRWCloseToTransferTimeRatio",
.add("openRWCloseToTransferTimeRatio",
m_stats.transferTime?(m_stats.openingTime+m_stats.readWriteTime+m_stats.closingTime)/m_stats.transferTime:0.0)
.add("FILEID",m_recallingFile->fileid())
.add("path",m_recallingFile->path());
......
......@@ -123,21 +123,21 @@ void DiskWriteThreadPool::addThreadStats(const DiskStats& other){
void DiskWriteThreadPool::logWithStat(int level, const std::string& message){
m_pooldStat.totalTime = m_totalTime.secs();
log::ScopedParamContainer params(m_lc);
params.addSnprintfDouble("poolReadWriteTime", m_pooldStat.readWriteTime)
.addSnprintfDouble("poolChecksumingTime",m_pooldStat.checksumingTime)
.addSnprintfDouble("poolWaitDataTime",m_pooldStat.waitDataTime)
.addSnprintfDouble("poolWaitReportingTime",m_pooldStat.waitReportingTime)
.addSnprintfDouble("poolCheckingErrorTime",m_pooldStat.checkingErrorTime)
.addSnprintfDouble("poolOpeningTime",m_pooldStat.openingTime)
.addSnprintfDouble("poolClosingTime", m_pooldStat.closingTime)
.addSnprintfDouble("poolRealTime",m_pooldStat.totalTime)
params.add("poolReadWriteTime", m_pooldStat.readWriteTime)
.add("poolChecksumingTime",m_pooldStat.checksumingTime)
.add("poolWaitDataTime",m_pooldStat.waitDataTime)
.add("poolWaitReportingTime",m_pooldStat.waitReportingTime)
.add("poolCheckingErrorTime",m_pooldStat.checkingErrorTime)
.add("poolOpeningTime",m_pooldStat.openingTime)
.add("poolClosingTime", m_pooldStat.closingTime)
.add("poolRealTime",m_pooldStat.totalTime)
.add("poolFileCount",m_pooldStat.filesCount)
.add("poolDataVolume", m_pooldStat.dataVolume)
.addSnprintfDouble("poolGlobalPayloadTransferSpeedMBps",
.add("poolGlobalPayloadTransferSpeedMBps",
m_pooldStat.totalTime?1.0*m_pooldStat.dataVolume/1000/1000/m_pooldStat.totalTime:0)
.addSnprintfDouble("poolAverageDiskPerformanceMBps",
.add("poolAverageDiskPerformanceMBps",
m_pooldStat.transferTime?1.0*m_pooldStat.dataVolume/1000/1000/m_pooldStat.transferTime:0.0)
.addSnprintfDouble("poolOpenRWCloseToTransferTimeRatio",
.add("poolOpenRWCloseToTransferTimeRatio",
m_pooldStat.transferTime?(m_pooldStat.openingTime+m_pooldStat.readWriteTime+m_pooldStat.closingTime)/m_pooldStat.transferTime:0.0);
m_lc.log(level,message);
}
......@@ -196,22 +196,22 @@ void DiskWriteThreadPool::DiskWriteWorkerThread::run() {
void DiskWriteThreadPool::DiskWriteWorkerThread::
logWithStat(int level, const std::string& msg) {
log::ScopedParamContainer params(m_lc);
params.addSnprintfDouble("threadReadWriteTime", m_threadStat.readWriteTime)
.addSnprintfDouble("threadChecksumingTime",m_threadStat.checksumingTime)
.addSnprintfDouble("threadWaitDataTime",m_threadStat.waitDataTime)
.addSnprintfDouble("threadWaitReportingTime",m_threadStat.waitReportingTime)
.addSnprintfDouble("threadCheckingErrorTime",m_threadStat.checkingErrorTime)
.addSnprintfDouble("threadOpeningTime",m_threadStat.openingTime)
.addSnprintfDouble("threadClosingTime", m_threadStat.closingTime)
.addSnprintfDouble("threadTransferTime",m_threadStat.transferTime)
.addSnprintfDouble("threadTotalTime",m_threadStat.totalTime)
params.add("threadReadWriteTime", m_threadStat.readWriteTime)
.add("threadChecksumingTime",m_threadStat.checksumingTime)
.add("threadWaitDataTime",m_threadStat.waitDataTime)
.add("threadWaitReportingTime",m_threadStat.waitReportingTime)
.add("threadCheckingErrorTime",m_threadStat.checkingErrorTime)
.add("threadOpeningTime",m_threadStat.openingTime)
.add("threadClosingTime", m_threadStat.closingTime)
.add("threadTransferTime",m_threadStat.transferTime)
.add("threadTotalTime",m_threadStat.totalTime)
.add("threadDataVolume",m_threadStat.dataVolume)
.add("threadFileCount",m_threadStat.filesCount)
.addSnprintfDouble("threadGlobalPayloadTransferSpeedMBps",
.add("threadGlobalPayloadTransferSpeedMBps",
m_threadStat.totalTime?1.0*m_threadStat.dataVolume/1000/1000/m_threadStat.totalTime:0)
.addSnprintfDouble("threadAverageDiskPerformanceMBps",
.add("threadAverageDiskPerformanceMBps",
m_threadStat.transferTime?1.0*m_threadStat.dataVolume/1000/1000/m_threadStat.transferTime:0.0)
.addSnprintfDouble("threadOpenRWCloseToTransferTimeRatio",
.add("threadOpenRWCloseToTransferTimeRatio",
m_threadStat.transferTime?(m_threadStat.openingTime+m_threadStat.readWriteTime+m_threadStat.closingTime)/m_threadStat.transferTime:0.0);
m_lc.log(level,msg);
}
......
......@@ -159,7 +159,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
m_stats.mountTime += timer.secs(castor::utils::Timer::resetCounter);
{
castor::log::ScopedParamContainer scoped(m_logContext);
scoped.addSnprintfDouble("mountTime", m_stats.mountTime);
scoped.add("mountTime", m_stats.mountTime);
m_logContext.log(LOG_INFO, "Tape mounted and drive ready");
}
// Then we have to initialise the tape read session
......@@ -168,7 +168,7 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::run() {
//and then report
{
castor::log::ScopedParamContainer scoped(m_logContext);
scoped.addSnprintfDouble("positionTime", m_stats.positionTime);
scoped.add("positionTime", m_stats.positionTime);
m_logContext.log(LOG_INFO, "Tape read session session successfully started");
}
m_initialProcess.tapeMountedForRead();
......@@ -236,15 +236,15 @@ void castor::tape::tapeserver::daemon::TapeReadSingleThread::logWithStat(
int level, const std::string& msg, log::ScopedParamContainer& params) {
params.add("type", "read")
.add("VID", m_volInfo.vid)
.addSnprintfDouble("mountTime", m_stats.mountTime)
.addSnprintfDouble("positionTime", m_stats.positionTime)
.addSnprintfDouble("waitInstructionsTime", m_stats.waitInstructionsTime)
.addSnprintfDouble("transferTime", m_stats.transferTime)
.addSnprintfDouble("waitFreeMemoryTime", m_stats.waitFreeMemoryTime)
.addSnprintfDouble("waitReportingTime", m_stats.waitReportingTime)
.addSnprintfDouble("unloadTime", m_stats.unloadTime)
.addSnprintfDouble("unmountTime", m_stats.unmountTime)
.addSnprintfDouble("totalTime", m_stats.totalTime)
.add("mountTime", m_stats.mountTime)
.add("positionTime", m_stats.positionTime)
.add("waitInstructionsTime", m_stats.waitInstructionsTime)
.add("transferTime", m_stats.transferTime)
.add("waitFreeMemoryTime", m_stats.waitFreeMemoryTime)
.add("waitReportingTime", m_stats.waitReportingTime)
.add("unloadTime", m_stats.unloadTime)
.add("unmountTime", m_stats.unmountTime)
.add("totalTime", m_stats.totalTime)
.add("dataVolume", m_stats.dataVolume)
.add("headerVolume", m_stats.headerVolume)
.add("files", m_stats.filesCount)
......
......@@ -137,11 +137,11 @@ public:
localStats.headerVolume += TapeSessionStats::trailerVolumePerFile;
// We now transmitted one file:
localStats.filesCount++;
params.addSnprintfDouble("positionTime", localStats.positionTime)
.addSnprintfDouble("transferTime", localStats.transferTime)
.addSnprintfDouble("waitFreeMemoryTime",localStats.waitFreeMemoryTime)
.addSnprintfDouble("waitReportingTime",localStats.waitReportingTime)
.addSnprintfDouble("totalTime", localStats.totalTime)
params.add("positionTime", localStats.positionTime)
.add("transferTime", localStats.transferTime)
.add("waitFreeMemoryTime",localStats.waitFreeMemoryTime)
.add("waitReportingTime",localStats.waitReportingTime)
.add("totalTime", localStats.totalTime)
.add("dataVolume",localStats.dataVolume)
.add("headerVolume",localStats.headerVolume)
.add("driveTransferSpeedMBps",
......
......@@ -118,7 +118,7 @@ protected:
castor::utils::Timer timer;
m_mc.mountTapeReadOnly(m_volInfo.vid, m_drive.librarySlot.str());
const std::string modeAsString = "R";
scoped.addSnprintfDouble("MCMountTime",timer.secs()).add("mode",modeAsString);
scoped.add("MCMountTime",timer.secs()).add("mode",modeAsString);
if(mediachanger::TAPE_LIBRARY_TYPE_MANUAL !=
m_drive.librarySlot.getLibraryType()) {
m_logContext.log(LOG_INFO, "Tape mounted for read-only access");
......@@ -144,7 +144,7 @@ protected:
castor::utils::Timer timer;
m_mc.mountTapeReadWrite(m_volInfo.vid, m_drive.librarySlot.str());
const std::string modeAsString = "RW";
scoped.addSnprintfDouble("MCMountTime",timer.secs()).add("mode",modeAsString);
scoped.add("MCMountTime",timer.secs()).add("mode",modeAsString);
m_logContext.log(LOG_INFO, "Tape mounted for read/write access");
}
catch (castor::exception::Exception & ex) {
......
......@@ -94,7 +94,7 @@ tapeFlush(const std::string& message,uint64_t bytes,uint64_t files,
log::ScopedParamContainer params(m_logContext);
params.add("files", files)
.add("bytes", bytes)
.addSnprintfDouble("flushTime", flushTime);
.add("flushTime", flushTime);
m_logContext.log(LOG_INFO,message);
m_stats.flushTime += flushTime;
......@@ -160,7 +160,7 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
m_stats.mountTime += timer.secs(castor::utils::Timer::resetCounter);
{
castor::log::ScopedParamContainer scoped(m_logContext);
scoped.addSnprintfDouble("mountTime", m_stats.mountTime);
scoped.add("mountTime", m_stats.mountTime);
m_logContext.log(LOG_INFO, "Tape mounted and drive ready");
}
......@@ -169,7 +169,7 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::run() {
m_stats.positionTime += timer.secs(castor::utils::Timer::resetCounter);
{
castor::log::ScopedParamContainer scoped(m_logContext);
scoped.addSnprintfDouble("positionTime", m_stats.positionTime);
scoped.add("positionTime", m_stats.positionTime);
m_logContext.log(LOG_INFO, "Write session initialised, tape VID checked and drive positioned for writing");
}
......@@ -269,17 +269,17 @@ void castor::tape::tapeserver::daemon::TapeWriteSingleThread::logWithStats(
int level,const std::string& msg, log::ScopedParamContainer& params){
params.add("type", "write")
.add("VID", m_volInfo.vid)
.addSnprintfDouble("mountTime", m_stats.mountTime)
.addSnprintfDouble("positionTime", m_stats.positionTime)
.addSnprintfDouble("waitInstructionsTime", m_stats.waitInstructionsTime)
.addSnprintfDouble("checksumingTime", m_stats.checksumingTime)
.addSnprintfDouble("transferTime", m_stats.transferTime)
.addSnprintfDouble("waitDataTime", m_stats.waitDataTime)
.addSnprintfDouble("waitReportingTime", m_stats.waitReportingTime)
.addSnprintfDouble("flushTime", m_stats.flushTime)
.addSnprintfDouble("unloadTime", m_stats.unloadTime)
.addSnprintfDouble("unmountTime", m_stats.unmountTime)
.addSnprintfDouble("totalTime", m_stats.totalTime)
.add("mountTime", m_stats.mountTime)
.add("positionTime", m_stats.positionTime)
.add("waitInstructionsTime", m_stats.waitInstructionsTime)
.add("checksumingTime", m_stats.checksumingTime)
.add("transferTime", m_stats.transferTime)
.add("waitDataTime", m_stats.waitDataTime)
.add("waitReportingTime", m_stats.waitReportingTime)
.add("flushTime", m_stats.flushTime)
.add("unloadTime", m_stats.unloadTime)
.add("unmountTime", m_stats.unmountTime)
.add("totalTime", m_stats.totalTime)
.add("dataVolume", m_stats.dataVolume)
.add("headerVolume", m_stats.headerVolume)
.add("files", m_stats.filesCount)
......
......@@ -263,11 +263,11 @@ namespace daemon {
void TapeWriteTask::logWithStats(int level, const std::string& msg,
log::LogContext& lc) const{
log::ScopedParamContainer params(lc);
params.addSnprintfDouble("transferTime", m_taskStats.transferTime)
.addSnprintfDouble("checksumingTime",m_taskStats.checksumingTime)
.addSnprintfDouble("waitDataTime",m_taskStats.waitDataTime)
.addSnprintfDouble("waitReportingTime",m_taskStats.waitReportingTime)
.addSnprintfDouble("totalTime", m_taskStats.totalTime)
params.add("transferTime", m_taskStats.transferTime)
.add("checksumingTime",m_taskStats.checksumingTime)
.add("waitDataTime",m_taskStats.waitDataTime)
.add("waitReportingTime",m_taskStats.waitReportingTime)
.add("totalTime", m_taskStats.totalTime)
.add("dataVolume",m_taskStats.dataVolume)
.add("headerVolume",m_taskStats.headerVolume)
.add("driveTransferSpeedMBps",m_taskStats.totalTime?
......
......@@ -374,7 +374,7 @@ private:
virtual void logStuckFile() {
castor::log::ScopedParamContainer params(m_lc);
params.addSnprintfDouble("TimeSinceLastBlockMove", m_blockMovementTimer.usecs())
params.add("TimeSinceLastBlockMove", m_blockMovementTimer.usecs())
.add("Path",m_file.path())
.add("FILEID",m_file.fileid())
.add("fSeq",m_file.fseq());
......
Markdown is supported
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