Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
482f44eb
Commit
482f44eb
authored
Sep 06, 2016
by
Victor Kotlyar
Browse files
Deleted castor::utils::Timer
parent
aa629531
Changes
21
Hide whitespace changes
Inline
Side-by-side
tapeserver/castor/tape/tapeserver/daemon/CatalogueDrive.hpp
View file @
482f44eb
...
...
@@ -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
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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.
*/
ca
stor
::
utils
::
Timer
m_launchTransferSessionTimer
;
c
t
a
::
utils
::
Timer
m_launchTransferSessionTimer
;
/**
* Checks that there is a tape session currently associated with the
...
...
tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.cpp
View file @
482f44eb
...
...
@@ -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)
ca
stor
::
utils
::
Timer
timer
;
c
t
a
::
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
);
ca
stor
::
utils
::
Timer
timer
;
c
t
a
::
utils
::
Timer
timer
;
if
(
mti
.
synchronousInjection
())
{
const
uint64_t
firstFseqFromClient
=
mti
.
firstFseqToWrite
();
...
...
tapeserver/castor/tape/tapeserver/daemon/DiskReadTask.cpp
View file @
482f44eb
...
...
@@ -23,7 +23,7 @@
#include
"castor/log/LogContext.hpp"
#include
"castor/tape/tapeserver/daemon/DiskReadTask.hpp"
#include
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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
;
ca
stor
::
utils
::
Timer
localTime
;
ca
stor
::
utils
::
Timer
totalTime
(
localTime
);
c
t
a
::
utils
::
Timer
localTime
;
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
openingTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitFreeMemoryTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
readWriteTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
checkingErrorTime
+=
localTime
.
secs
(
c
t
a
::
utils
::
Timer
::
resetCounter
);
// We are done with the block, push it to the write task
m_nextTask
.
pushDataBlock
(
mb
);
...
...
tapeserver/castor/tape/tapeserver/daemon/DiskReadThreadPool.cpp
View file @
482f44eb
...
...
@@ -159,12 +159,12 @@ void DiskReadThreadPool::DiskReadWorkerThread::run() {
m_lc
.
log
(
LOG_DEBUG
,
"Starting DiskReadWorkerThread"
);
std
::
unique_ptr
<
DiskReadTask
>
task
;
ca
stor
::
utils
::
Timer
localTime
;
ca
stor
::
utils
::
Timer
totalTime
;
c
t
a
::
utils
::
Timer
localTime
;
c
t
a
::
utils
::
Timer
totalTime
;
while
(
1
)
{
task
.
reset
(
m_parent
.
popAndRequestMore
(
m_lc
));
m_threadStat
.
waitInstructionsTime
+=
localTime
.
secs
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_threadStat
.
waitInstructionsTime
+=
localTime
.
secs
(
c
t
a
::
utils
::
Timer
::
resetCounter
);
if
(
NULL
!=
task
.
get
())
{
task
->
execute
(
m_lc
,
m_parent
.
m_diskFileFactory
,
m_parent
.
m_watchdog
);
m_threadStat
+=
task
->
getTaskStats
();
...
...
tapeserver/castor/tape/tapeserver/daemon/DiskReadThreadPool.hpp
View file @
482f44eb
...
...
@@ -30,7 +30,7 @@
#include
"common/threading/Threading.hpp"
#include
"common/threading/AtomicCounter.hpp"
#include
"castor/log/LogContext.hpp"
#include
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/Timer.hpp"
#include
<vector>
#include
<stdint.h>
...
...
@@ -137,7 +137,7 @@ private:
/**
* Measure the thread pool's lifetime
*/
ca
stor
::
utils
::
Timer
m_totalTime
;
c
t
a
::
utils
::
Timer
m_totalTime
;
/**
* A disk file factory, that will create the proper type of file access class,
...
...
tapeserver/castor/tape/tapeserver/daemon/DiskWriteTask.cpp
View file @
482f44eb
...
...
@@ -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
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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
;
ca
stor
::
utils
::
Timer
localTime
;
ca
stor
::
utils
::
Timer
totalTime
(
localTime
);
ca
stor
::
utils
::
Timer
transferTime
(
localTime
);
c
t
a
::
utils
::
Timer
localTime
;
c
t
a
::
utils
::
Timer
totalTime
(
localTime
);
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitDataTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
checkingErrorTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
openingTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
readWriteTime
+=
localTime
.
secs
(
c
t
a
::
utils
::
Timer
::
resetCounter
);
checksum
=
mb
->
m_payload
.
adler32
(
checksum
);
m_stats
.
checksumingTime
+=
localTime
.
secs
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
checksumingTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
closingTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitReportingTime
+=
localTime
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitReportingTime
+=
localTime
.
secs
(
c
t
a
::
utils
::
Timer
::
resetCounter
);
log
::
ScopedParamContainer
params
(
lc
);
params
.
add
(
"errorMessage"
,
e
.
getMessageValue
());
logWithStat
(
LOG_ERR
,
"File writing to disk failed."
,
lc
);
...
...
tapeserver/castor/tape/tapeserver/daemon/DiskWriteThreadPool.cpp
View file @
482f44eb
...
...
@@ -23,7 +23,7 @@
#include
"castor/tape/tapeserver/daemon/DiskWriteThreadPool.hpp"
#include
"castor/common/CastorConfiguration.hpp"
#include
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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
;
ca
stor
::
utils
::
Timer
localTime
;
ca
stor
::
utils
::
Timer
totalTime
(
localTime
);
c
t
a
::
utils
::
Timer
localTime
;
c
t
a
::
utils
::
Timer
totalTime
(
localTime
);
while
(
1
)
{
task
.
reset
(
m_parentThreadPool
.
m_tasks
.
pop
());
m_threadStat
.
waitInstructionsTime
+=
localTime
.
secs
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_threadStat
.
waitInstructionsTime
+=
localTime
.
secs
(
c
t
a
::
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
))
{
...
...
tapeserver/castor/tape/tapeserver/daemon/DiskWriteThreadPool.hpp
View file @
482f44eb
...
...
@@ -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
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/Timer.hpp"
#include
<vector>
#define __STDC_FORMAT_MACROS
#include
<inttypes.h>
...
...
@@ -189,7 +189,7 @@ private:
/**
* Measure the thread pool's lifetime
*/
ca
stor
::
utils
::
Timer
m_totalTime
;
c
t
a
::
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) */
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.cpp
View file @
482f44eb
...
...
@@ -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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_this
.
m_stats
.
waitReportingTime
+=
m_timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_this
.
m_stats
.
unloadTime
+=
m_timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_this
.
m_stats
.
unmountTime
+=
m_timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_this
.
m_stats
.
waitReportingTime
+=
m_timer
.
secs
(
c
t
a
::
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"
));
ca
stor
::
utils
::
Timer
timer
,
totalTimer
;
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
mountTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
positionTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitReportingTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitInstructionsTime
+=
timer
.
secs
(
c
t
a
::
utils
::
Timer
::
resetCounter
);
// If we reached the end
if
(
NULL
==
task
.
get
())
{
m_logContext
.
log
(
LOG_DEBUG
,
"No more files to read from tape"
);
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp
View file @
482f44eb
...
...
@@ -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
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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
ca
stor
::
utils
::
Timer
&
m_timer
;
c
t
a
::
utils
::
Timer
&
m_timer
;
public:
TapeCleaning
(
TapeReadSingleThread
&
parent
,
ca
stor
::
utils
::
Timer
&
timer
)
:
TapeCleaning
(
TapeReadSingleThread
&
parent
,
c
t
a
::
utils
::
Timer
&
timer
)
:
m_this
(
parent
),
m_timer
(
timer
){}
~
TapeCleaning
();
};
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeReadTask.hpp
View file @
482f44eb
...
...
@@ -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
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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
,
ca
stor
::
utils
::
Timer
&
timer
)
{
TapeSessionStats
&
stats
,
c
t
a
::
utils
::
Timer
&
timer
)
{
using
castor
::
log
::
Param
;
...
...
@@ -77,8 +77,8 @@ public:
// stats to the session's.
TapeSessionStats
localStats
;
std
::
string
LBPMode
;
ca
stor
::
utils
::
Timer
localTime
;
ca
stor
::
utils
::
Timer
totalTime
(
localTime
);
c
t
a
::
utils
::
Timer
localTime
;
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
localStats
.
positionTime
+=
timer
.
secs
(
c
t
a
::
utils
::
Timer
::
resetCounter
);
watchdog
.
notifyBeginNewJob
(
m_retrieveJob
->
archiveFile
.
archiveFileID
,
m_retrieveJob
->
selectedTapeFile
().
fSeq
);
localStats
.
waitReportingTime
+=
timer
.
secs
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
localStats
.
waitReportingTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
localStats
.
waitFreeMemoryTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
localStats
.
readWriteTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
localStats
.
waitReportingTime
+=
timer
.
secs
(
c
t
a
::
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
);
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeSingleThreadInterface.hpp
View file @
482f44eb
...
...
@@ -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
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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
{
ca
stor
::
utils
::
Timer
timer
;
c
t
a
::
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
{
ca
stor
::
utils
::
Timer
timer
;
c
t
a
::
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
{
ca
stor
::
utils
::
Timer
timer
;
c
t
a
::
utils
::
Timer
timer
;
// wait 600 drive is ready
m_drive
.
waitUntilReady
(
600
);
log
::
LogContext
::
ScopedParam
sp0
(
m_logContext
,
log
::
Param
(
"loadTime"
,
timer
.
secs
()));
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.cpp
View file @
482f44eb
...
...
@@ -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
,
ca
stor
::
utils
::
Timer
&
timer
)
c
t
a
::
utils
::
Timer
&
timer
)
{
m_drive
.
flush
();
double
flushTime
=
timer
.
secs
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
double
flushTime
=
timer
.
secs
(
c
t
a
::
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"
);
ca
stor
::
utils
::
Timer
timer
,
totalTimer
;
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
mountTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
positionTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitReportingTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
waitInstructionsTime
+=
timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_stats
.
flushTime
+=
timer
.
secs
(
c
t
a
::
utils
::
Timer
::
resetCounter
);
//end of session + log
m_reportPacker
.
reportEndOfSession
();
log
::
LogContext
::
ScopedParam
sp0
(
m_logContext
,
log
::
Param
(
"tapeThreadDuration"
,
totalTimer
.
secs
()));
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeWriteSingleThread.hpp
View file @
482f44eb
...
...
@@ -34,7 +34,7 @@
#include
"common/threading/BlockingQueue.hpp"
#include
"common/threading/Threading.hpp"
#include
"castor/tape/tapeserver/file/File.hpp"
#include
"c
astor/utils
/Timer.hpp"
#include
"c
ommon
/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
ca
stor
::
utils
::
Timer
&
m_timer
;
c
t
a
::
utils
::
Timer
&
m_timer
;
public:
TapeCleaning
(
TapeWriteSingleThread
&
parent
,
ca
stor
::
utils
::
Timer
&
timer
)
:
TapeCleaning
(
TapeWriteSingleThread
&
parent
,
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_this
.
m_stats
.
unloadTime
+=
m_timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_this
.
m_stats
.
unmountTime
+=
m_timer
.
secs
(
c
t
a
::
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
(
ca
stor
::
utils
::
Timer
::
resetCounter
);
m_this
.
m_stats
.
waitReportingTime
+=
m_timer
.
secs
(
c
t
a
::
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
,
ca
stor
::
utils
::
Timer
&
timer
);
c
t
a
::
utils
::
Timer
&
timer
);
virtual
void
run
()
;
...
...
tapeserver/castor/tape/tapeserver/daemon/TapeWriteTask.cpp
View file @
482f44eb
...
...
@@ -64,7 +64,7 @@ namespace daemon {
//------------------------------------------------------------------------------
void
TapeWriteTask
::
execute
(
castor
::
tape
::
tapeFile
::
WriteSession
&
session
,
MigrationReportPacker
&
reportPacker
,
MigrationWatchDog
&
watchdog
,
castor
::
log
::
LogContext
&
lc
,
ca
stor
::
utils
::
Timer
&
timer
)
{
castor
::
log
::
LogContext
&
lc
,
c
t
a
::
utils
::
Timer
&
timer
)
{
using
castor
::
log
::
LogContext
;
using
castor
::
log
::
Param
;