|
| ProgressDisplay () |
| Constructor. More...
|
|
| ProgressDisplay () |
|
virtual void | BeginJob (uint16_t jobNum, uint16_t jobTotal, const XrdCl::URL *source, const XrdCl::URL *destination) |
| Begin job. More...
|
|
virtual void | EndJob (uint16_t jobNum, const XrdCl::PropertyList *results) |
| End job. More...
|
|
virtual void | EndJob (uint16_t jobNum, const XrdCl::PropertyList *results) |
|
std::string | GetProgressBar (time_t now) |
| Get progress bar. More...
|
|
std::string | GetSummaryBar (time_t now) |
| Get sumary bar. More...
|
|
virtual void | JobProgress (uint16_t jobNum, uint64_t bytesProcessed, uint64_t bytesTotal) |
| Job progress. More...
|
|
virtual void | JobProgress (uint16_t jobNum, uint64_t bytesProcessed, uint64_t bytesTotal) |
|
void | PrintAdditionalCheckSum (bool print) |
|
void | PrintCheckSum (const XrdCl::URL *url, const std::string &checkSum, uint64_t size) |
| Print the checksum. More...
|
|
void | PrintProgressBar (bool print) |
|
void | PrintSourceCheckSum (bool print) |
|
void | PrintTargetCheckSum (bool print) |
|
Public Member Functions inherited from XrdCl::CopyProgressHandler |
virtual | ~CopyProgressHandler () |
|
virtual bool | ShouldCancel (uint16_t jobNum) |
| Determine whether the job should be canceled. More...
|
|
Definition at line 45 of file XrdClCopy.cc.
◆ ProgressDisplay() [1/2]
ProgressDisplay::ProgressDisplay |
( |
| ) |
|
|
inline |
Constructor.
Definition at line 51 of file XrdClCopy.cc.
51 : pPrevious(0), pPrintProgressBar(
true),
52 pPrintSourceCheckSum(
false), pPrintTargetCheckSum(
false),
53 pPrintAdditionalCheckSum(
false)
◆ ProgressDisplay() [2/2]
ProgressDisplay::ProgressDisplay |
( |
| ) |
|
|
inline |
Definition at line 1427 of file XrdClFS.cc.
1427 : pBytesProcessed(0), pBytesTotal(0), pPrevious(0)
◆ BeginJob()
virtual void ProgressDisplay::BeginJob |
( |
uint16_t |
jobNum, |
|
|
uint16_t |
jobTotal, |
|
|
const XrdCl::URL * |
source, |
|
|
const XrdCl::URL * |
destination |
|
) |
| |
|
inlinevirtual |
Begin job.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 59 of file XrdClCopy.cc.
65 if( pPrintProgressBar )
69 std::cerr <<
"Job: " << jobNum <<
"/" << jobTotal << std::endl;
70 std::cerr <<
"Source: " << source->
GetURL() << std::endl;
71 std::cerr <<
"Target: " << destination->
GetURL() << std::endl;
79 d.target = destination;
80 pOngoingJobs[jobNum] = d;
std::string GetURL() const
Get the URL.
References XrdCl::URL::GetURL().
◆ EndJob() [1/2]
End job.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 86 of file XrdClCopy.cc.
90 std::map<uint16_t, JobData>::iterator it = pOngoingJobs.find( jobNum );
91 if( it == pOngoingJobs.end() )
94 JobData &d = it->second;
99 JobProgress( jobNum, d.bytesProcessed, d.bytesTotal );
101 if( pPrintProgressBar )
103 if( pOngoingJobs.size() > 1 )
104 std::cerr <<
"\r" << std::string(70,
' ') <<
"\r";
106 std::cerr << std::endl;
110 results->
Get(
"status", st );
113 pOngoingJobs.erase(it);
117 std::string checkSum;
119 results->
Get(
"size", size );
120 if( pPrintSourceCheckSum )
122 results->
Get(
"sourceCheckSum", checkSum );
126 if( pPrintTargetCheckSum )
128 results->
Get(
"targetCheckSum", checkSum );
132 if( pPrintAdditionalCheckSum )
134 std::vector<std::string> addcksums;
135 results->
Get(
"additionalCkeckSum", addcksums );
136 for(
auto &cks : addcksums )
140 pOngoingJobs.erase(it);
void PrintCheckSum(const XrdCl::URL *url, const std::string &checkSum, uint64_t size)
Print the checksum.
virtual void JobProgress(uint16_t jobNum, uint64_t bytesProcessed, uint64_t bytesTotal)
Job progress.
bool Get(const std::string &name, Item &item) const
bool IsOK() const
We're fine.
References XrdCl::PropertyList::Get(), XrdCl::Status::IsOK(), JobProgress(), and PrintCheckSum().
◆ EndJob() [2/2]
Notify when the previous job has finished
- Parameters
-
jobNum | job number |
result | result of the job |
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 1433 of file XrdClFS.cc.
1435 JobProgress( jobNum, pBytesProcessed, pBytesTotal );
1436 std::cerr << std::endl;
◆ GetProgressBar()
std::string ProgressDisplay::GetProgressBar |
( |
time_t |
now | ) |
|
|
inline |
Get progress bar.
Definition at line 146 of file XrdClCopy.cc.
148 JobData &d = pOngoingJobs.begin()->second;
152 speed = d.bytesProcessed/(now-d.started);
154 speed = d.bytesProcessed;
162 prog = (int)((
double)d.bytesProcessed/d.bytesTotal*50);
163 proc = (int)((
double)d.bytesProcessed/d.bytesTotal*100);
170 bar.append( prog,
'=' );
174 std::ostringstream o;
177 o <<
"[" << std::setw(3) << std::right << proc <<
"%]";
178 o <<
"[" << std::setw(50) << std::left;
static std::string BytesToString(uint64_t bytes)
Convert bytes to a human readable string.
References XrdCl::Utils::BytesToString().
Referenced by JobProgress().
◆ GetSummaryBar()
std::string ProgressDisplay::GetSummaryBar |
( |
time_t |
now | ) |
|
|
inline |
Get sumary bar.
Definition at line 188 of file XrdClCopy.cc.
190 std::map<uint16_t, JobData>::iterator it;
191 std::ostringstream o;
193 for( it = pOngoingJobs.begin(); it != pOngoingJobs.end(); ++it )
195 JobData &d = it->second;
196 uint16_t jobNum = it->first;
200 speed = d.bytesProcessed/(now-d.started);
204 proc = (int)((
double)d.bytesProcessed/d.bytesTotal*100);
208 o <<
"[#" << jobNum <<
": ";
References XrdCl::Utils::BytesToString().
Referenced by JobProgress().
◆ JobProgress() [1/2]
virtual void ProgressDisplay::JobProgress |
( |
uint16_t |
jobNum, |
|
|
uint64_t |
bytesProcessed, |
|
|
uint64_t |
bytesTotal |
|
) |
| |
|
inlinevirtual |
Job progress.
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 219 of file XrdClCopy.cc.
225 if( pPrintProgressBar )
227 time_t now = time(0);
228 if( (now - pPrevious < 1) && (bytesProcessed != bytesTotal) )
232 std::map<uint16_t, JobData>::iterator it = pOngoingJobs.find( jobNum );
233 if( it == pOngoingJobs.end() )
236 JobData &d = it->second;
238 d.bytesProcessed = bytesProcessed;
239 d.bytesTotal = bytesTotal;
241 std::string progress;
242 if( pOngoingJobs.size() == 1 )
247 std::cerr <<
"\r" << progress << std::flush;
std::string GetProgressBar(time_t now)
Get progress bar.
std::string GetSummaryBar(time_t now)
Get sumary bar.
References GetProgressBar(), and GetSummaryBar().
Referenced by EndJob().
◆ JobProgress() [2/2]
virtual void ProgressDisplay::JobProgress |
( |
uint16_t |
jobNum, |
|
|
uint64_t |
bytesProcessed, |
|
|
uint64_t |
bytesTotal |
|
) |
| |
|
inlinevirtual |
Notify about the progress of the current job
- Parameters
-
jobNum | job number |
bytesProcessed | bytes processed by the current job |
bytesTotal | total number of bytes to be processed by the current job |
Reimplemented from XrdCl::CopyProgressHandler.
Definition at line 1442 of file XrdClFS.cc.
1446 pBytesProcessed = bytesProcessed;
1447 pBytesTotal = bytesTotal;
1449 time_t now = time(0);
1450 if( (now - pPrevious < 1) && (bytesProcessed != bytesTotal) )
1455 std::cerr <<
"Progress: ";
1459 std::cerr <<
"(" << bytesProcessed*100/bytesTotal <<
"%)";
1461 std::cerr << std::flush;
References XrdCl::Utils::BytesToString().
◆ PrintAdditionalCheckSum()
void ProgressDisplay::PrintAdditionalCheckSum |
( |
bool |
print | ) |
|
|
inline |
Definition at line 282 of file XrdClCopy.cc.
282 { pPrintAdditionalCheckSum = print; }
Referenced by main().
◆ PrintCheckSum()
void ProgressDisplay::PrintCheckSum |
( |
const XrdCl::URL * |
url, |
|
|
const std::string & |
checkSum, |
|
|
uint64_t |
size |
|
) |
| |
|
inline |
Print the checksum.
Definition at line 254 of file XrdClCopy.cc.
258 if( checkSum.empty() )
260 std::string::size_type i = checkSum.find(
':' );
261 std::cerr << checkSum.substr( 0, i+1 ) <<
" ";
262 std::cerr << checkSum.substr( i+1, checkSum.length()-i ) <<
" ";
265 std::cerr << url->
GetPath() <<
" ";
269 std::cerr << url->
GetPath() <<
" ";
273 std::cerr << std::endl;
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
const std::string & GetProtocol() const
Get the protocol.
const std::string & GetPath() const
Get the path.
References XrdCl::URL::GetHostId(), XrdCl::URL::GetPath(), XrdCl::URL::GetProtocol(), and XrdCl::URL::IsLocalFile().
Referenced by EndJob().
◆ PrintProgressBar()
void ProgressDisplay::PrintProgressBar |
( |
bool |
print | ) |
|
|
inline |
◆ PrintSourceCheckSum()
void ProgressDisplay::PrintSourceCheckSum |
( |
bool |
print | ) |
|
|
inline |
◆ PrintTargetCheckSum()
void ProgressDisplay::PrintTargetCheckSum |
( |
bool |
print | ) |
|
|
inline |
The documentation for this class was generated from the following files: